Question

I'm trying to learn PyInstaller. I created two simple files, Test.py:

import os

and Test.spec:

anal = Analysis (["Test.py"])
pyz = PYZ(anal.pure)
exe = EXE(anal.scripts, pyz, name="Test.exe", exclude_binaries=1, debug=1)
coll = COLLECT(exe, anal.binaries, name="dist")

Then I ran:

Build.py Test.spec

This ran without any error mesages, and produced a directory dist with several files, including Test.exe. When I ran Test.exe, it failed with the output:

Found embedded PKG: C:\Documents and Settings\Rade\My Documents\Development\Test\Test.exe
Extracting binaries
manifestpath: C:\Documents and Settings\Rade\My Documents\Development\Test\Test.
exe.manifest
Error activating the context
python27.dll
Manipulating evironment
PYTHONPATH=C:/Documents and Settings/Rade/My Documents/Development/Test
importing modules from CArchive
extracted iu
extracted struct
extracted archive
Installing import hooks
outPYZ1.pyz
Running scripts
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named os
RC: -1 from Test
OK.

I'm sure I have made some stupid beginner's mistake, but what?

Was it helpful?

Solution

For simple files like this, you should use Makespec.py for creating spec's instead of writing manually. For large projects, you could use the Makespec.py's output as a template and edit them.

http://www.pyinstaller.org/export/latest/tags/1.4/doc/Manual.html#create-a-spec-file-for-your-project

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top