Compile on Win7 -> Deploy to Vista/XP...

  • myddrn

    myddrn - 2009-11-19

    Hi there.  Great program, I'll give you some money when I'm not broke.

    I've noticed a fun little problem when I try to compile this on Windows 7 Ultimate 32 bit edtion with python 2.5.4 and all the associated dependancies for python 2.5.4.  Once the dist directory is created with the python py2exe command I can run the resulting code just fine on the computer I compiled it on.  However, when I take the dist directory to another computer running Vista and/or XP Pro SP3 I get errors in the log file to the tune of:

        Traceback (most recent call last):
          File "keylogger.pyw", line 54, in <module>
          File "detailedlogwriter.pyc", line 35, in <module>
          File "win32api.pyc", line 12, in <module>
          File "win32api.pyc", line 10, in __load
        ImportError: DLL load failed: The specified procedure could not be found.
    My first thought was the DLLs py2exe was complaining about at the end of its output:

        *** binary dependencies ***
        Your executable(s) also depend on these dlls which are not included,
        you may or may not need to distribute them.
        Make sure you have the license if you distribute any of them, and
        make sure you don't distribute files belonging to the operating system.
           ole32.dll - C:\Windows\system32\ole32.dll
           OLEAUT32.dll - C:\Windows\system32\OLEAUT32.dll
           USER32.dll - C:\Windows\system32\USER32.dll
           IMM32.dll - C:\Windows\system32\IMM32.dll
           SHELL32.dll - C:\Windows\system32\SHELL32.dll
           ntdll.dll - C:\Windows\system32\ntdll.dll
           comdlg32.dll - C:\Windows\system32\comdlg32.dll
           WSOCK32.dll - C:\Windows\system32\WSOCK32.dll
           COMCTL32.dll - C:\Windows\system32\COMCTL32.dll
           ADVAPI32.dll - C:\Windows\system32\ADVAPI32.dll
           msvcrt.dll - C:\Windows\system32\msvcrt.dll
           WS2_32.dll - C:\Windows\system32\WS2_32.dll
           GDI32.dll - C:\Windows\system32\GDI32.dll
           VERSION.dll - C:\Windows\system32\VERSION.dll
           KERNEL32.dll - C:\Windows\system32\KERNEL32.dll
           SETUPAPI.dll - C:\Windows\system32\SETUPAPI.dll
           RPCRT4.dll - C:\Windows\system32\RPCRT4.dll

    Using the shotgun approach to problem solving I used  to include ALL the dlls there, and then re-ran the py2exe bit.  It then spit out two more DLLs that I forget the names of, which I added to the includes list, and re-ran py2exe again.  I took THAT massive thing over to the winXP machine, ran it and got the following in the error log(last two lines, I missplaced the rest of it, but it was about as long as the first DLL error message and complaining about tk instead of win32api):

        File "_tkinter.pyc", line 10, in __loadImport
        Error: DLL load failed: The specified procedure could not be found.

    My guess is that this is probably some esoteric Windows 7 problem with py2exe and DLLs and I have a few more ideas to try before passing out.  I wanted to shoot this off into the void while I'm still coherent enough to make some kind of sense.  I understand I could probably get around it by just py2exe'ing the thing on an XP machine, but I'd like to figure out WHY it doesn't work on Windows 7.  I've had similar problems with py2exe and Vista before too.

    I have a decent amount of python experience and a very minimal amount of py2exe experience.
    I'll update this thread with any progress.


  • nanotube

    nanotube - 2009-11-19


    Thanks a lot for posting this, and in such detail.

    I personally only have access to winxp, so haven't dealt with this problem and cannot test any of this.

    One thing i can suggest is to include /all/ dlls, by defining your dll test function in that always returns 0, as follows:

        def isSystemDLL(pathname):
             return 0
        py2exe.build_exe.isSystemDLL = isSystemDLL

    This will produce a /giant/ distribution, but at least you'll know everything is there. ;)

    give that a try and see what happens…

  • Anonymous - 2010-07-03

    I have the exact same message as you do and I was wondering if you have discovered a work around for this yet.

  • nanotube

    nanotube - 2010-07-07

    did you try what was suggested in post #2?

  • William Kreider

    William Kreider - 2010-07-17

    yes nanotube I have and the file is very large. I've installed it and when I try to run it now it complains again most of them deal with tkinter

  • nanotube

    nanotube - 2010-07-28

    well… then maybe you should try building on the same os as your target comp… since i don't have anything other than winxp and can't play around with this stuff to test, i haven't any further nuggets of wisdom to suggest…


Log in to post a comment.