[vtkusers] Importing vtkpython

David Gobbi dgobbi at irus.rri.on.ca
Mon Aug 21 13:52:22 EDT 2000


On Mon, 21 Aug 2000, Mikkel Bollinger wrote:

> I'm writing an VTK application in python. I have recently downloaded 
> the nightly release of VTK and run configure with: 
> ./configure --with-mesa --with-shared --with-x --with-python \
>      --with-tkwidget --with-patented --with-contrib
> VTK is then compiled but an error is raised when I try to import the VTK
> modules from python:
> 
> >>> from vtkpython import *
> Traceback (innermost last): 
>   File "<stdin>", line 1, in ? 
> ImportError: ./vtkpython.so: undefined symbol: initlibVTKLocalPython
> 
> I have then tried to configure VTK with the additional 
> option: --with-local. However, then the compilation cannot be completed
> due to missing files in the 'local' directory.
> 
> Is there somebody who has encountered the same problem (and found a
> solution) ?

Here is a quick fix: bring up vtk/python/vtkpython.c in a text editor and
remove the following lines (at the bottom of the file):

  initlibVTKLocalPython();
  m2 = PyImport_AddModule("libVTKLocalPython");
  d2 = PyModule_GetDict(m2);
  if (d2) 
    {
    n = PyDict_Size(d2);
    i = 0;
    for (j = 0; j < n; j++)
      {
      PyDict_Next(d2,&i,&k,&v);
      PyDict_SetItem(d1,k,v);
      }
    }

I'll dedicate some time this week to eliminate this problem.  The
best solution might be for the vtkpython module under UNIX to simply be a
python script that loads all of the  "libVTK*Python" libraries
individually within a try/except.  The reason that I did not do this
originally was because (way back when) there were crossed references
between libVTKPatented.so and libVTKGraphics.so that made it impossible.

 - David

--
  David Gobbi, MSc                    dgobbi at irus.rri.on.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario





More information about the vtkusers mailing list