Pyinstaller 1.5 with Python 2.6 (Round 3)

Round 1 with Pyinstaller 1.2 and Python 2.4 was here: PyInstaller1.2
Round 2 with Pyinstaller 1.3 and Python 2.5 was here: PyInstaller Round 2

Overview:

  1. Put latest copy of pyinstaller under the appropriate python folder e.g. Python26
  2. Run Configure.py e.g.

    C:\Python26\python.exe C:\Python26\Pyinstaller-1.5\Configure.py

  3. Make a dev folder and put main script in there and a copy of the most recent spec file made for any other project. Use as a starting point.
  4. Make a bat file to produce the executable using the spec file to configure the end result e.g.

    "C:\Python26\python.exe" "C:\Python26\pyinstaller-1.5\Build.py" "myproj.spec"
    pause

    Include the pause so any errors can be spotted and fixed

  5. Make another batch script which runs the executable and has the pause command at the end so you can spot any errors and fix them (so screen doesn’t flash on and off without giving you a chance to read the error messages if any). NB no python.exe involved – just the exe you made e.g.

    myproj.exe
    pause

  6. Once testing is complete, remake the exe with live spec settings i.e. set console to False and debug to False.
  7. Distribute 🙂

Mistakes to avoid:

  • Testing the exe with a batch file is good. Having the batch file try to run the exe with python, not so good (in fact, it is dumb 😉 ). Just run the exe on its own. Otherwise spurious error about encoding problem with line 1 of the exe. See Why this SyntaxError
  • If making a script which execs everything else it needs (reason: to keep things flexible), the main script e.g. “exec_script2exec.py” MUST import anything needed by scripts it is likely to call otherwise they will not appear in the exe. Pyinstaller can’t read minds or predict the future 😉 . So import wx and import win32com.client are probably required for my MS Access project. Otherwise will get an error about no module called wx etc.

3 thoughts on “Pyinstaller 1.5 with Python 2.6 (Round 3)

  1. Pingback: pssst … » PyInstaller Round 2

  2. Pingback: pssst … » PyInstaller and making a Python program for deployment

  3. Pingback: pssst … » Pyinstaller and win32com

Comments are closed.