[vtkusers] Python wrappers for new extensions developed with C++

David Gobbi dgobbi at atamai.com
Thu Jun 14 14:24:50 EDT 2007


Hi Jordi,

If you were able to make libvtkLocalPython.so, then all you should have 
left to do is set the pythonpath.

The file libvtkLocalPython.so is a python extension module, so it must 
be in the PYTHONPATH before you can load it.  The PYTHONPATH isn't only 
for .py files.

"
export PYTHONPATH=./bin/
"

Note that usually you should use the full absolute path, instead of a 
relative path starting with "."

 - David



Jordi Campos i Miralles wrote:
> Hi, 
>
> Is there any complete example like VTK/Examples/Build/vtkLocal but
> including a Python test?
>
> I followed the indications of the standard example
> VTK/Examples/Build/vtkLocal, but it only has a TCL example. I created a
> simple filter in C++ as vtkLocalExample.h/cxx.
>
> I commented the "IF(VTK_WRAP_PYTHON)" line present in the CMakeList.txt
> to be sure the "wrapper instructions" are executed.
>
> With a "make" I obtain the wrapper libs "bin/libvtkLocalPython.so" and
> "bin/libvtkLocalPython.so", but I still need the way to load them from
> my python example.
>
> If I try to do an "import vtkLocal" it does not work.
>
> I check the standard python wrappers an I tried with:
>
> "
> import os
>
> if os.name == 'posix':
>     from libvtkLocalPython import *
> else:
>     from vtkLocalPython import *
> "
>
> and executed it with: 
> "
> LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./bin/ vtkpython test.py
> "
>
> But I can't load the library. I guess I should update also the
> PYTHONPATH, but I need some "library" .py ...
>
> What I'm doing wrong?
>
> Is there any complete example like VTK/Examples/Build/vtkLocal but
> including a Python test?
>
> Thanks a lot!
>
> jor;)i
>
>
> BTW: I'm preparing a tutorial for my research group partners about
> Volume Rendering with VTK that can be found here:
>
> http://namaste.maia.ub.es/public/vtk-volume-rendering-tutorial.pdf
>
> Would it be possible to add the pdf to VTK Wiki when I finish it?
>
>
>   




More information about the vtkusers mailing list