[vtkusers] Python wrapping

Gib Bogle g.bogle at auckland.ac.nz
Sun Nov 2 15:51:23 EST 2014


Hi David,

Thanks for that clarification.  I don't know much about Python, and less about Python wrapping in VTK.

I have no idea why the simple example program fails.  The code is:
 http://www.vtk.org/Wiki/VTK/Examples/Python/Visualization/ProgGlyph
with the first line changed (or removed - it makes no difference).

PYTHONPATH includes C:\vtk-vs10-x64\lib\site-packages\vtk, and all the .pyd files are there.

The first entry in PATH is C:\vtk-vs10-x64\bin.  Do I need any other VTK directories in the path?

In the error message, repeated below, can you tell me for which DLL does the DLL load fail?

D:\testing\VTK\Superquadric>vtkpython superquadric.py
Traceback (most recent call last):
  File "superquadric.py", line 3, in <module>  import vtk
  File "C:\VTK-VS10-x64\lib\site-packages\vtk\__init__.py", line 63, in <module> __helper.refine_import_err('rendering', 'vtkRenderingPython', exc)
  File "C:\VTK-VS10-x64\lib\site-packages\vtk\__helper.py", line 32, in refine_import_err raise LinkError, str(exc)
vtk.__helper.LinkError: DLL load failed: %1 is not a valid Win32 application.

Both python27 and VTK are 64-bit.

By the way, what are the vtk*PythonD.dll files?

Thanks
Gib
________________________________
From: David Gobbi [david.gobbi at gmail.com]
Sent: Monday, 3 November 2014 2:18 a.m.
To: Gib Bogle
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] Python wrapping

Hi Gib,

The vtk*Python.pyd files are the DLLs that you are looking for.  See here:
https://docs.python.org/2/faq/windows.html#is-a-pyd-file-the-same-as-a-dll

 - David

On Sun, Nov 2, 2014 at 12:09 AM, Gib Bogle <g.bogle at auckland.ac.nz<mailto:g.bogle at auckland.ac.nz>> wrote:
Hi David,

All the .pyd files are where they should be, and all the vtk*PythonD.dll files are where they should be, in C:\vtk-vs10-x64\bin, which is in the PATH.  The point of my question was that the VTK release build did not create any vtk*Python.dll files, although it did create the .lib files.  Correct me if I'm wrong, but I think that vtkpython is looking for the missing DLL files - specifically, for vtkRenderingPython.dll.  Am I wrong in thinking that they should have been built?

Gib
________________________________
From: David Gobbi [david.gobbi at gmail.com<mailto:david.gobbi at gmail.com>]
Sent: Sunday, 2 November 2014 4:11 p.m.
To: Gib Bogle
Cc: vtkusers at vtk.org<mailto:vtkusers at vtk.org>
Subject: Re: [vtkusers] Python wrapping

Hi Gib,

The python modules are called "vtk*Python.pyd" on Windows.
On your system, I'm guessing that they should be in this directory:
c:\VTK-VS10-x64\lib\site-packages\vtk

And, in order for the modules to be loaded, all of the VTK DLLs
must also be in your PATH.  Either that, or you can copy them all
into c:\VTK-VS10-x64\lib\site-packages\vtk so that the .pyd files
will be able to find them there.

The vtk*PythonD.dll files are not python modules, they are support
libraries that are needed by the python modules.

 - David



On Sat, Nov 1, 2014 at 8:54 PM, Gib Bogle <g.bogle at auckland.ac.nz<mailto:g.bogle at auckland.ac.nz>> wrote:
I just rebuilt VTK-5.10.1 64-bit on Windows with VTK_WRAP_PYTHON ON.  The build completed without errors.  I do not understand why I have 14 .lib and .dll files named vtk*PythonD.dll and vtk*PythonD.lib, and 14 .lib files named vtk*Python.lib, but no vtk*Python.dll.  This causes my attempt to run a VTK-Python example to fail like this:

D:\testing\VTK\Superquadric>vtkpython superquadric.py
Traceback (most recent call last):
  File "superquadric.py", line 1, in <module>  import vtk
  File "c:\VTK-VS10-x64\lib\site-packages\vtk\__init__.py", line 63, in <module>  __helper.refine_import_err('rendering', 'vtkRenderingPython', exc)
  File "c:\VTK-VS10-x64\lib\site-packages\vtk\__helper.py", line 32, in refine_import_err raise LinkError, str(exc)
vtk.__helper.LinkError: DLL load failed: %1 is not a valid Win32 application.

I see that somebody was asking exactly the same question back in October, 2010, but there was no answer.

Any suggestions?

Thanks
Gib


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141102/6bbd1690/attachment.html>


More information about the vtkusers mailing list