Program:

import subprocess
import shlex

def run_cmd(cmd):
    cmd=shlex.split(cmd)
    try:
        output=subprocess.check_output(cmd, stderr=subprocess.STDOUT)
    except Exception as exc:
        print ">>>", exc.output
    else:
        print output

def main():
    cmd='python -S -c "import sys; print sys.path"'
    run_cmd(cmd)

    print "\n\n"

    cmd='python -S -c "import random; print random.randint(0,10)"'
    run_cmd(cmd)

if __name__=="__main__":
    main()


Build Command:

python PATH\TO\pyinstaller.py test.py --onefile


Execution Output:

C:\Users\XXX\Desktop\testing>dist\test.exe
['', 'C:/Users/XXX/AppData/Local/Temp/_MEI110482', 
'C:/Users/XXX/Desktop/testing/dist', 'C:\\Windows\\system32\\python27.zip', 
'C:/Use
rs/XXX/AppData/Local/Temp/_MEI110482/\\DLLs', 
'C:/Users/XXX/AppData/Local/Temp/_MEI110482/\\lib', 
'C:/Users/XXX/AppData/Local/Temp/
_MEI110482/\\lib\\plat-win', 
'C:/Users/XXX/AppData/Local/Temp/_MEI110482/\\lib\\lib-tk', 'C:\\PYTHON27']


>>> Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named random


AFAICT, because the PYTHONPATH points to the temp expanded area, you can 
not run python as a subprocess which might use different modules because 
PYTHONPATH is not set to the installed path.

Adding -p to the build command does not seem to help.

Help!

Thanks!! << q

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pyinstaller/-/DHvSmfDp4S8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyinstaller?hl=en.

Reply via email to