[Paraview] [EXTERNAL] Re: ParaView python in a generic python
Scott, W Alan
wascott at sandia.gov
Tue Feb 4 12:39:13 EST 2014
Thanks - that is exactly what I was looking for!
Alan
From: Sebastien Jourdain [mailto:sebastien.jourdain at kitware.com]
Sent: Tuesday, February 04, 2014 9:58 AM
To: Andy Bauer
Cc: Scott, W Alan; paraview at paraview.org
Subject: [EXTERNAL] Re: [Paraview] ParaView python in a generic python
Hi Alan,
here is the way I do it when I code stuff in Sublime Text and directly execute code within the editor.
import sys
pv_path = '/Users/seb/work/code/ParaView/build-ninja'
sys.path.append('%s/lib' % pv_path)
sys.path.append('%s/lib/site-packages' % pv_path)
from paraview.simple import *
Seb
On Tue, Feb 4, 2014 at 8:09 AM, Andy Bauer <andy.bauer at kitware.com<mailto:andy.bauer at kitware.com>> wrote:
Hi Alan,
Are they working from a version of ParaView that used the installers? That's what I'm assuming for my next comments. For Mac I think they need to use DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH. I tried going through to do this myself and wasn't able to completely do it but was getting further along. Basically I opened a Python shell and tried manually importing the parts in servermanager.py. I'm not in front of a Mac right now so I can't point you to all of the paths I was using but basically I would add parts to the DYLD_LIBRARY_PATH and then do another import where if would give me more informative errors (things like can't find library /X/Y/Z/xxx.so).
Not a full solution but maybe enough to get you going in the proper direction.
Regards,
Andy
On Mon, Feb 3, 2014 at 3:20 PM, Scott, W Alan <wascott at sandia.gov<mailto:wascott at sandia.gov>> wrote:
I have two users that wants to use ParaView paraview.simple commands from a generic version of Python (i.e., not pvpython). Are there any tricks to getting this to work? One user is on a Mac, the other is on Linux. As you can see, my user is having issues even importing paraview.simple.
Here is a copy of the errors the user is having:
>import sys
>sys.path
['/Applications/paraview.app/Contents/Python', '/Applications/paraview.app/Contents/Libraries', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload', '/Library/Python/2.6/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC']
>From looking at this, I added '/Applications/paraview.app/Contents/Python' and '/Applications/paraview.app/Contents/Libraries' to my PYTHONPATH. I also made a guess at which directory to add to my LD_LIBRARY_PATH. Unfortunately, it did not work, as you can see below:
$ echo $PYTHONPATH
:/Applications/paraview.app/Contents/Libraries/:/Applications/paraview.app/Contents/Python
$ echo $LD_LIBRARY_PATH :/Applications/paraview.app/Contents/Libraries/:/Applications/paraview.app/Contents/Python/vtk
$ python
>>> import paraview.simple
Error: Could not import vtkCommonComputationalGeometryPython
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Applications/paraview.app/Contents/Python/paraview/simple.py", line 41, in <module>
import servermanager
File "/Applications/paraview.app/Contents/Python/paraview/servermanager.py", line 48, in <module>
import paraview, re, os, os.path, new, sys, atexit, vtk
File "/Applications/paraview.app/Contents/Python/paraview/vtk/__init__.py", line 7, in <module>
from vtkCommonCorePython import *
ImportError: dlopen(/Applications/paraview.app/Contents/Libraries/vtkCommonCorePython.so, 2): Library not loaded: @executable_path/../Libraries/libvtkCommonCorePython26D-pv4.1.1.dylib
Referenced from: /Applications/paraview.app/Contents/Libraries/vtkCommonCorePython.so
Reason: image not found
>>>
Thanks,
Alan
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20140204/77adb7d9/attachment-0001.html>
More information about the ParaView
mailing list