[Paraview] python scripts

Patrick Shinpaugh shpatric at vt.edu
Wed Sep 24 16:22:22 EDT 2008


It was my fault. I had named the scripts by the vis software being used 
so paraview.py, visit.py, etc. Changing it to pv.py fixed it.

Thanks very much for the help,
Pat


Utkarsh Ayachit wrote:
> In /home/project is there a "paraview.py" or a directory named 
> "paraview" ? If so, try moving or renaming that.
>
> Utkarsh
>
> Patrick Shinpaugh wrote:
>> I created the script you posted. The results of each are displayed 
>> below:
>>
>> pvpython ~/paraview-test-path.py
>> ['/home/project', '/usr/local/ParaView-3.2.2/lib/paraview-3.2', 
>> '/usr/lib/python25.zip', '/usr/lib/python2.5', 
>> '/usr/lib/python2.5/plat-linux2',
>> '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', 
>> '/usr/lib/python2.5/site-packages', 
>> '/usr/lib/python2.5/site-packages/Numeric',
>> /usr/lib/python2.5/site-packages/PIL', 
>> '/usr/lib/python2.5/site-packages/gst-0.10', 
>> '/usr/lib/python2.5/site-packages/gtk-2.0']
>>
>> pvbatch ~/paraview-test-path.py
>> ['/home/project', '/usr/local/ParaView-3.2.2/lib/paraview-3.2', 
>> '/usr/lib/python25.zip', '/usr/lib/python2.5', 
>> '/usr/lib/python2.5/plat-linux2',
>> /usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', 
>> '/usr/lib/python2.5/site-packages', 
>> '/usr/lib/python2.5/site-packages/Numeric',
>> /usr/lib/python2.5/site-packages/PIL', 
>> '/usr/lib/python2.5/site-packages/gst-0.10', 
>> '/usr/lib/python2.5/site-packages/gtk-2.0']
>>
>> from paraview gui - tools/python shell/run script
>> ['/usr/local/ParaView-3.2.2/lib/paraview-3.2', 
>> '/usr/lib/python25.zip', '/usr/lib/python2.5', 
>> '/usr/lib/python2.5/plat-linux2',
>> '/usr/lib/python2.5/lib-tk', /usr/lib/python2.5/lib-dynload', 
>> '/usr/lib/python2.5/site-packages', 
>> '/usr/lib/python2.5/site-packages/Numeric',
>> /usr/lib/python2.5/site-packages/PIL', 
>> /usr/lib/python2.5/site-packages/gst-0.10', 
>> '/usr/lib/python2.5/site-packages/gtk-2.0']
>>
>> Interestingly, the only difference is the home directory at the 
>> beginning for pvbatch/pvpython...
>>
>> Any ideas?
>>
>> Pat
>>
>>
>> Utkarsh Ayachit wrote:
>>> That's weird.
>>> from paraview import servermanager
>>> should work from all the 3 locations client, pvbatch or pvpython.
>>>
>>> Can you try the following script and print your path in all the 
>>> three applications?
>>>
>>> import sys
>>> print sys.path
>>>
>>> Utkarsh
>>>
>>> Patrick Shinpaugh wrote:
>>>> Hi,
>>>> I've been writing some python scripts and running them through the 
>>>> paraview GUI. I start the scripts with
>>>>
>>>>    from paraview import servermanager
>>>>
>>>> When I use pvpython or pvbatch to run the same scripts I receive an 
>>>> error:
>>>>
>>>> [project] pvpython paraview.py
>>>> Traceback (most recent call last):
>>>>  File "paraview.py", line 1, in <module>
>>>>    from paraview import servermanager
>>>>  File "/home/project/paraview.py", line 1, in <module>
>>>>    from paraview import servermanager
>>>> ImportError: cannot import name servermanager
>>>>
>>>>
>>>> After messing with this for a while I finally tried:
>>>>
>>>>    import servermanager
>>>>
>>>> which worked.
>>>>
>>>> Question: Why is there a difference in the way the servermanager is 
>>>> imported between paraview gui and pvpython/pvbatch? Have other 
>>>> people run across this issue? This is version 3.2.2. Is it possible 
>>>> there is something wrong my build? If this is something I just have 
>>>> to live with, is there a way to prevent the error from closing the 
>>>> script/interpreter, check to see if the first import failed and 
>>>> then run the second import?
>>>>
>>>> Thanks,
>>>> Pat
>>>>
>>>
>>
>

-- 
Patrick Shinpaugh
Virginia Tech
UVAG System Administrator/Programmer
540-231-2054



More information about the ParaView mailing list