[Paraview] question on using python programmable source

Jed Frechette jedfrechette at gmail.com
Fri May 30 18:30:55 EDT 2008


On May 30, 2008, at 3:21 PM, Berk Geveci wrote:

>> Unfortunately, I need to include the quotes when entering a path in  
>> the ui,
>> otherwise Python will throw an exception when it tries to do:
>>
>> filename = /tmp/test.xyz
>>
>> Is there a way to modify the ui so that it automatically returns a  
>> raw
>> string containing whatever is entered in a text box?
>
> What happens when you enter the filename between the quotes currently?
> Are the quotes discarded?

If I enter the filename with quotes everything works fine. I haven't  
dug into the source but based on the exception I think whatever is  
entered in the ui text box is assigned verbatim to the variable so:

'/tmp/test.xyz'

works but:

/tmp/test.xyz

raises an exception.

> It sounds like we really need a type for the
> parameters so that it automatically quotes string parameters.

That's what I was wondering about if there was something like a  
type="String" attribute for the xml. I guess another option would be  
to just return all input as raw string's and let the script worry  
about doing conversions. The latter was the behavior I originally  
expected given the name of the element, StringVectorProperty.

> I would like to see a programmable reader in the future. It would be
> very cool if you somehow you specify a python script and register it
> with the list of readers. The file name(s) would be passed to this
> reader from the GUI. This would be pretty easy to do from the XML if
> we create a new VTK class.


That would be ideal and it doesn't seem like the required  
functionality would be all that different from the current programable  
source.

Best,

--
Jed Frechette

University of New Mexico Lidar Lab
www.unm.edu/~lidar



More information about the ParaView mailing list