[vtkusers] Importing a local class in Python fails

Daniël Lacko lacko.daniel at gmail.com
Fri Mar 23 15:00:17 EDT 2012


Hi all,

I'm new to vtk and I've written a local class that I would like to
implement in my Python programs. However, I'm having some trouble importing
the local class into my projects. To be sure I got the process right, I
tried compiling and importing the example class first. I took the following
steps:

- I copied the vtkLocal folder to an out-of-source location.
- I left CMakeLists.txt as it is, since I wanted to test build a clean
solution.
- I ran Cmake as usual; configured for use with Visual Studio 2010 C++
Express. The only thing I changed was CMAKE_INSTALL_PREFIX.
- I opened the VS2010 solution and built the entire solution in release
mode.
- I added {build-folder}\bin\Release\ folder to the system path.

I'm using 32-bit python 2.7 and a vtk version I compiled from
source (pulled from Git at 2012/05/03), also with Visual Studio 2010 C++
Express on a Windows 7 Professional 64-bit system. Whenever I try importing
vtkLocal in Python, I get a "No module named vtkLocal" error. I've tried
adding the bin\Release\ location to the Python site-packages directory
(which I also use to point to vtk), using sys.path.append() and
sys.path.insert() and running python directly from within the bin\Release\
directory. I've tried importing different class names, such as
vtkLocalPython, libvtkLocal and libvtkLocalPython with various
capitalizations. None of this seems so work, even though all the right
.lib's and .dll's seem to be there. Does anyone have an idea as to what I'm
doing wrong?

Thanks in advance,

Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120323/c5d0da96/attachment.htm>


More information about the vtkusers mailing list