<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Thanks David.  'import vtkCommonPython' works, as do several other modules.  Meantime I looked more closely at the depends info and realized that it was finding 32-bit Qt libraries. 
 Putting the 64-bit Qt directory at the start of PATH fixed that, and now it works :)  I guess vtkRendering needs Qt while several of the others do not.<br>
<br>
It really is a nuisance having both 32-bit and 64-bit libraries on my system, but I cannot switch completely to 64-bit, for various reasons.<br>
<br>
Thanks for your help<br>
Gib<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF622250"><font color="#000000" face="Tahoma" size="2"><b>From:</b> David Gobbi [david.gobbi@gmail.com]<br>
<b>Sent:</b> Monday, 3 November 2014 10:52 a.m.<br>
<b>To:</b> Gib Bogle<br>
<b>Cc:</b> vtkusers@vtk.org<br>
<b>Subject:</b> Re: [vtkusers] Python wrapping<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">Hi Gib,
<div><br>
</div>
<div>Yes, the .pyd files should be in the PYTHONPATH and the DLLs</div>
<div>should be in the PATH.  That's all that should be needed.</div>
<div><br>
</div>
<div>My best guess is that it is failing to load vtkRenderingPython.pyd</div>
<div>itself, and it you hadn't specifically told me that both your python</div>
<div>and your VTK are 64-bit, my guess would be that it was trying to</div>
<div>load a 64-bit .pyd file into a 32-bit python.</div>
<div><br>
</div>
<div>Try to see if you can load the .pyd files directly, by doing this in python:</div>
<div><br>
</div>
<div>  import vtkCommonPython</div>
<div><br>
</div>
<div>When that fails, it should provide a more meaningful error message.</div>
<div>In any case, it's always best to start testing with the module that has</div>
<div>the fewest dependencies (i.e. Common) and then work up from there.</div>
<div><br>
</div>
<div>The vtk*PythonD.dll files have all the code that actually translates</div>
<div>python method calls into VTK C++ method calls.  But they aren't</div>
<div>python modules (i.e. they have no python "init" method).  They are,</div>
<div>in essence, the back-end of the wrappers while the vtk*Python.pyd</div>
<div>files are the front-end.</div>
<div><br>
</div>
<div> - David </div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sun, Nov 2, 2014 at 1:51 PM, Gib Bogle <span dir="ltr">
<<a href="mailto:g.bogle@auckland.ac.nz" target="_blank">g.bogle@auckland.ac.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Hi David,<br>
<br>
Thanks for that clarification.  I don't know much about Python, and less about Python wrapping in VTK.<br>
<br>
I have no idea why the simple example program fails.  The code is:<br>
 <a href="http://www.vtk.org/Wiki/VTK/Examples/Python/Visualization/ProgGlyph" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Python/Visualization/ProgGlyph</a><br>
with the first line changed (or removed - it makes no difference).<br>
<br>
PYTHONPATH includes C:\vtk-vs10-x64\lib\site-packages\vtk, and all the .pyd files are there.<br>
<br>
The first entry in PATH is C:\vtk-vs10-x64\bin.  Do I need any other VTK directories in the path?<br>
<br>
In the error message, repeated below, can you tell me for which DLL does the DLL load fail?<span><br>
<br>
D:\testing\VTK\Superquadric>vtkpython superquadric.py<br>
Traceback (most recent call last):<br>
  File "superquadric.py", line 3, in <module>  import vtk<br>
  File "C:\VTK-VS10-x64\lib\site-packages\vtk\__init__.py", line 63, in <module> __helper.refine_import_err('rendering', 'vtkRenderingPython', exc)<br>
  File "C:\VTK-VS10-x64\lib\site-packages\vtk\__helper.py", line 32, in refine_import_err raise LinkError, str(exc)<br>
vtk.__helper.LinkError: DLL load failed: %1 is not a valid Win32 application.<br>
<br>
</span>Both python27 and VTK are 64-bit.<br>
<br>
By the way, what are the vtk*PythonD.dll files?<br>
<br>
Thanks<br>
Gib<br>
<div style="font-family:Times New Roman; color:#000000; font-size:16px">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> David Gobbi [<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>]<br>
<b>Sent:</b> Monday, 3 November 2014 2:18 a.m.
<div>
<div><br>
<b>To:</b> Gib Bogle<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Subject:</b> Re: [vtkusers] Python wrapping<br>
</div>
</div>
</font><br>
</div>
<div>
<div>
<div></div>
<div>
<div dir="ltr">Hi Gib,
<div><br>
</div>
<div>The vtk*Python.pyd files are the DLLs that you are looking for.  See here:</div>
<div><a href="https://docs.python.org/2/faq/windows.html#is-a-pyd-file-the-same-as-a-dll" target="_blank">https://docs.python.org/2/faq/windows.html#is-a-pyd-file-the-same-as-a-dll</a></div>
<div><br>
</div>
<div> - David  </div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sun, Nov 2, 2014 at 12:09 AM, Gib Bogle <span dir="ltr">
<<a href="mailto:g.bogle@auckland.ac.nz" target="_blank">g.bogle@auckland.ac.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Hi David,<br>
<br>
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?<br>
<br>
Gib<br>
<div style="font-family:Times New Roman; color:#000000; font-size:16px">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> David Gobbi [<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>]<br>
<b>Sent:</b> Sunday, 2 November 2014 4:11 p.m.<br>
<b>To:</b> Gib Bogle<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Subject:</b> Re: [vtkusers] Python wrapping<br>
</font><br>
</div>
<div>
<div>
<div></div>
<div>
<div dir="ltr">Hi Gib,
<div><br>
</div>
<div>The python modules are called "vtk*Python.pyd" on Windows.</div>
<div>On your system, I'm guessing that they should be in this directory:</div>
<div><span style="color:rgb(0,0,0); font-family:Tahoma; font-size:13.3333339691162px">c:\VTK-VS10-x64\lib\site-</span><span style="color:rgb(0,0,0); font-family:Tahoma; font-size:13.3333339691162px">packages\vtk</span><br>
</div>
<div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">And, in order for the modules to be loaded, all of the VTK DLLs</div>
<div class="gmail_extra">must also be in your PATH.  Either that, or you can copy them all</div>
<div class="gmail_extra">into <span style="font-size:13.3333339691162px; color:rgb(0,0,0); font-family:Tahoma">c:\VTK-VS10-x64\lib\site-</span><span style="font-size:13.3333339691162px; color:rgb(0,0,0); font-family:Tahoma">packages\vtk so that the .pyd files</span></div>
<div class="gmail_extra"><span style="font-size:13.3333339691162px; color:rgb(0,0,0); font-family:Tahoma">will be able to find them there.</span></div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">The vtk*PythonD.dll files are not python modules, they are support</div>
<div class="gmail_extra">libraries that are needed by the python modules.</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra"> - David</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sat, Nov 1, 2014 at 8:54 PM, Gib Bogle <span dir="ltr">
<<a href="mailto:g.bogle@auckland.ac.nz" target="_blank">g.bogle@auckland.ac.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-color:rgb(204,204,204); border-left-style:solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:rgb(0,0,0); font-size:10pt">
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:<br>
<br>
D:\testing\VTK\Superquadric>vtkpython superquadric.py<br>
Traceback (most recent call last):<br>
  File "superquadric.py", line 1, in <module>  import vtk<br>
  File "c:\VTK-VS10-x64\lib\site-packages\vtk\__init__.py", line 63, in <module>  __helper.refine_import_err('rendering', 'vtkRenderingPython', exc)<br>
  File "c:\VTK-VS10-x64\lib\site-packages\vtk\__helper.py", line 32, in refine_import_err raise LinkError, str(exc)<br>
vtk.__helper.LinkError: DLL load failed: %1 is not a valid Win32 application.<br>
<br>
I see that somebody was asking exactly the same question back in October, 2010, but there was no answer.<br>
<br>
Any suggestions?<br>
<br>
Thanks<span><font color="#888888"><br>
Gib<br>
</font></span></div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>