dpitch40
dpitch40

Reputation: 2691

Trouble running an application made with PyInstaller, importing GTK--searching nonexistent directories

I am trying to create an executable of my Python application that uses PyGTK to make a GUI. I have a well-established, automated build process using Pyinstaller that has worked for me for a previous application. Suffice it to say that it calls the usual Makespec.py and Build.py with 32-bit Python 2.7, with Pyinstaller configured for 32 bits. The resulting 32-bit application works fine on my machine and another machine running Windows 7 64-bit, but fails on 32-bit Windows XP with this error:

C:\OutNav_0_64\OutNav_0.64>outnav
Traceback (most recent call last):
  File "<string>", line 23, in <module>
  File "C:\Pyinstaller-1.5\iu.py", line 436, in importHook
  File "C:\Pyinstaller-1.5\iu.py", line 521, in doimport
  File "C:\Users\462974\Documents\Local Sandbox\tools\utilities\Oni\build\pyi.win32\OutNav\outPYZ1.pyz/gtk", line 40, in
 <module>
  File "C:\Pyinstaller-1.5\iu.py", line 477, in importHook
  File "C:\Pyinstaller-1.5\iu.py", line 495, in doimport
  File "C:\Pyinstaller-1.5\iu.py", line 297, in getmod
  File "C:\Pyinstaller-1.5\archive.py", line 468, in getmod
  File "C:\Pyinstaller-1.5\iu.py", line 109, in getmod
ImportError: DLL load failed: The specified procedure could not be found.

The strange part is, there is no C:\Pyinstaller-1.5 directory on my machine or the one experiencing the error. I have no idea why it is attempting to run code from this nonexistent directory, or what the missing DLL is. Can anyone help me fold PyGTK into my application?

NOTE: The first line of the trace, line 23 in my program, is

import gtk

UPDATE: My manager successfully ran it on 64-bit Windows XP. UPDATE 2: He was mistaken, it was 64-bit Windows 7. It has the same problem on his Windows XP installation.

Also, on the original machine it failed on, from the directory of the executable, I did this:

>>> import imp
>>> fp = open('gtk._gtk.pyd', 'rb')
>>> mod = imp.load_module('gtk._gtk', fp, 'gtk._gtk.pyd', ('.pyd', 'rb', 3))

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

Upvotes: 0

Views: 2266

Answers (1)

dpitch40
dpitch40

Reputation: 2691

As far as I can tell, the .pyd file (which is in the format of a .DLL file) generated by pyinstaller on Windows 7 is incompatible with Windows XP. My solution was to simply recreate my build process on a Windows XP machine, which solved it to my satisfaction.

Upvotes: 3

Related Questions