#1
  1. Rut row Raggy!
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2001
    Location
    Tornado Alley
    Posts
    560
    Rep Power
    31

    Question Error loading Python script as .exe


    I made a Python script based on the sample program I found here:

    http://wiki.wxpython.org/index.cgi/S...p?action=print

    I also made the setup.py and setup.cfg files as printed in that article.

    But, when I compiled it into a .exe file using py2exe, I get the an error saying something like "python22.dll was not found," when the .exe file is opened on another computer (with Python not installed). Why is this? I thought the goal of py2exe was to allow Python programmers to deploy their creations to computers w/out Python. Did I miss something? If worse comes to worse, I can always compile the .exe file into a installer program with python22.dll, but where should it be installed? Thanks to anyone who can help!!
    Matt
  2. #2
  3. No Profile Picture
    TROGDOR the BURNINATOR
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    Northern CA
    Posts
    2
    Rep Power
    0

    Cool Error loading Python script as .exe


    When you complie a python script with py2exe, the dist directory contains all of the files needed to run the application. Sometimes it will contain the python22.dll file, but mostly (in every case that i have built applications with py2exe) the files in the dist directory are .pyd files. These are essentially .dll files with the extension renamed to .pyd

    Now, when you install the built application on a computer with out python installed, the library files (which is essentially what the python22.dll file is) need to be in a location that either the OS or the program can find. On a windows system, it is usually easiest to install them into the application directory. You can also install the python22.dll file into a location in you system path (something like "c:/windows/system32", or "c:/winnt/system32").

    If you would like an example of an installer or need a visual concept of what i am talking about, please email me and ill be happy to help out.

    Oh, forgot to mention that the executable create with py2exe is merely a zip archive that contains all of the .pyc files for you application and is set to execute you main file when you double click the .exe
    Last edited by techsplicer; March 10th, 2003 at 09:50 PM.
  4. #3
  5. Rut row Raggy!
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2001
    Location
    Tornado Alley
    Posts
    560
    Rep Power
    31
    Thanks for the info techsplicer. I'm surprised how few Python fans there are here! Anyway, I was hoping all that was needed was the .exe file, but stuffing them into a setup .exe is no big deal. I downloaded a free program called InoSetup or something like that. Haven't tested it out with my own program, but it looks pretty simple. My main question was were the setup script was suppose to put the .dll file(s). So it needs to be in the system folder? I figured that, but wanted to make sure it couldn't also be left in the program's folder (in Program Files), which would be easier b/c not everyone knows where their system folder is. BTW, I don't remember seeing any files in the dist folder other than the program and the .dll file. Thanks again!
    Matt
  6. #4
  7. No Profile Picture
    TROGDOR the BURNINATOR
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    Northern CA
    Posts
    2
    Rep Power
    0
    InoSetup is the same setup program that i use. It is quite handy and actually has some neat extensions to it.

    Also, remember, that the library files (.pyd, .dll, etc.) can also be placed into the application directory (i.e. the location that you install the .exe). That is usually the easiest place to install them and to make sure that you dont overwrite another installations files (if they happen to have another py2exe compiled applicaiton installed).

    As far as the dist directory goes, the number of files can varry depending upon the libraries that you imported (i.e. import sys, or from wxPython.wx import *).

    Hope that this helps....
  8. #5
  9. Rut row Raggy!
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2001
    Location
    Tornado Alley
    Posts
    560
    Rep Power
    31
    Okay, that makes sense. I'm glad I can just save all the files from the dist directory into Program Files/my program's folder. That will make things easier on those who I send the programs to. Thanks again.
    Matt

IMN logo majestic logo threadwatch logo seochat tools logo