Regards
--
Florian Höch
Changing the scripts and hacking sys.path is not a good idea. You should
use $PYTHONPATH for this. This is what it is meant for.
--
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP, CSSLP
Goebel Consult
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de
Monatliche Kolumne: http://www.cissp-gefluester.de/
Goebel Consult mit Mitglied bei http://www.7-it.de
Yes, adding it to PYTHONPATH works, but isn't very intuitive imho. Maybe
adding some other options to pyinstaller.py could be another
possibility? E.g.
pyinstaller.py --bindepend <binary>
pyinstaller.py --viewarchive <binary>
etc.
> Changing the scripts and hacking sys.path is not a good idea. You should
> use $PYTHONPATH for this. This is what it is meant for.
That's why I called it a hack :) I think I'd prefer something like my
above suggestion.
Regards
--
Florian Höch
The problem is you are running on Windows, from the "wrong" directory.
Are you using the GUI (Windows explorer), or are you working from
command line?
So one solution could be adding a .bat file. But this would require a
.bat for each of the files in utils. So the better solution is to just
run from the PyInstaller main directory like this:
python utils\bindepend.py
BTW: pyinstaller.py does not use any any "binary", but uses modules
imported from package PyInstaller (which is located in directory
PyInstaller)
I guess the list got rid of the spaces that were originally there. It
should read like this (hope the list won't mangle it again):
pyinstaller.py --bindepend binary
pyinstaller.py --viewarchive binary
(there should now hopefully be spaces between the option and the 'binary')
> The problem is you are running on Windows, from the "wrong" directory.
> Are you using the GUI (Windows explorer), or are you working from
> command line?
Command line, from the 'root' pyinstaller directory (not the
'PyInstaller' module subdirectory).
> So one solution could be adding a .bat file. But this would require a
> .bat for each of the files in utils. So the better solution is to just
> run from the PyInstaller main directory like this:
>
> python utils\bindepend.py
Yes, but this only works if the pyinstaller root directory is on
PYTHONPATH. Not a big problem of course, but personally I do not often
(have to) change PYTHONPATH and have a tendency to forget about it after
a while when I do, which then leads to certain things working for me but
not for others etc. pp. That's why I don't really like changing it, but
it's only personal preference.
> BTW: pyinstaller.py does not use any any "binary", but uses modules
> imported from package PyInstaller (which is located in directory
> PyInstaller)
Sure, but how does that relate to my suggestion? Sorry I don't understand.
Regards
--
Florian Höch
No, stop, *aaaaaahhhhhh* It's Windows! Windows ignores case in filenames
*aaahhhh*
The scripts in utils try to import e.g. PyInstaller.bindepend. But since
Windows uses case-insensitive filenames, the file pyinstaller.py gets
loaded instead of PyInstaller/__init__.py (and further on
PyInstaller/bindepend.py)
Please run
python -v -c 'import PyInstaller.bindepend'
and post the relevant lines (after the Python interactive startup
message) here.
On my machine this looks like:
Python 2.6.5 (r265:79063, Oct 29 2010, 14:35:07)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import PyInstaller # directory PyInstaller
import PyInstaller # from PyInstaller/__init__.py
import PyInstaller.bindepend # from PyInstaller/bindepend.py
--
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP, CSSLP
Goebel Consult
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de/blog
Monatliche Kolumne: http://www.cissp-gefluester.de/aktuelle
Ok, I get:
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import PyInstaller # directory PyInstaller
# PyInstaller\__init__.pyc matches PyInstaller\__init__.py
import PyInstaller # precompiled from PyInstaller\__init__.pyc
# PyInstaller\bindepend.pyc matches PyInstaller\bindepend.py
import PyInstaller.bindepend # precompiled from PyInstaller\bindepend.pyc
Regards
--
Florian Höch
What is the output if you are running python -v utils\bindepend.py
--
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP, CSSLP
Goebel Consult
Spezialist für IT-Sicherheit in komplexen Umgebungen
Monatliche Kolumne: http://www.cissp-gefluester.de/
(Should that file exist there? In my local copy and also in SVN, it's in
PyInstaller)
python -v PyInstaller\bindepend.py
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import time # builtin
# C:\Python26\lib\string.pyc matches C:\Python26\lib\string.py
import string # precompiled from C:\Python26\lib\string.pyc
import strop # builtin
# C:\Python26\lib\glob.pyc matches C:\Python26\lib\glob.py
import glob # precompiled from C:\Python26\lib\glob.pyc
# C:\Python26\lib\fnmatch.pyc matches C:\Python26\lib\fnmatch.py
import fnmatch # precompiled from C:\Python26\lib\fnmatch.pyc
# C:\Python26\lib\traceback.pyc matches C:\Python26\lib\traceback.py
import traceback # precompiled from C:\Python26\lib\traceback.pyc
Traceback (most recent call last):
File "PyInstaller\bindepend.py", line 42, in <module>
from PyInstaller import is_win, is_cygwin, is_darwin, is_py26
ImportError: No module named PyInstaller
Regards
--
Florian Höch
Sorry, this should have been on of the scripts, e.g.:
python -v utils\Build.py
Ah, ok.
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
File "utils\Build.py", line 22, in <module>
import PyInstaller.build
ImportError: No module named PyInstaller.build
Regards
--
Florian Höch
Ok, here is the complete output:
python -v utils\Build.py
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# C:\Python26\lib\site.pyc matches C:\Python26\lib\site.py
import site # precompiled from C:\Python26\lib\site.pyc
# C:\Python26\lib\os.pyc matches C:\Python26\lib\os.py
import os # precompiled from C:\Python26\lib\os.pyc
import errno # builtin
import nt # builtin
# C:\Python26\lib\ntpath.pyc matches C:\Python26\lib\ntpath.py
import ntpath # precompiled from C:\Python26\lib\ntpath.pyc
# C:\Python26\lib\stat.pyc matches C:\Python26\lib\stat.py
import stat # precompiled from C:\Python26\lib\stat.pyc
# C:\Python26\lib\genericpath.pyc matches C:\Python26\lib\genericpath.py
import genericpath # precompiled from C:\Python26\lib\genericpath.pyc
# C:\Python26\lib\warnings.pyc matches C:\Python26\lib\warnings.py
import warnings # precompiled from C:\Python26\lib\warnings.pyc
# C:\Python26\lib\linecache.pyc matches C:\Python26\lib\linecache.py
import linecache # precompiled from C:\Python26\lib\linecache.pyc
# C:\Python26\lib\types.pyc matches C:\Python26\lib\types.py
import types # precompiled from C:\Python26\lib\types.pyc
# C:\Python26\lib\UserDict.pyc matches C:\Python26\lib\UserDict.py
import UserDict # precompiled from C:\Python26\lib\UserDict.pyc
# C:\Python26\lib\_abcoll.pyc matches C:\Python26\lib\_abcoll.py
import _abcoll # precompiled from C:\Python26\lib\_abcoll.pyc
# C:\Python26\lib\abc.pyc matches C:\Python26\lib\abc.py
import abc # precompiled from C:\Python26\lib\abc.pyc
# C:\Python26\lib\copy_reg.pyc matches C:\Python26\lib\copy_reg.py
import copy_reg # precompiled from C:\Python26\lib\copy_reg.pyc
# zipimport: found 78 names in
C:\Python26\lib\site-packages\setuptools-0.6c11-py2.6.egg
# zipimport: found 9 names in
C:\Python26\lib\site-packages\pefile-1.2.10_63-py2.6.egg
# zipimport: found 21 names in
C:\Python26\lib\site-packages\altgraph-0.6.7-py2.6.egg
# zipimport: found 90 names in
C:\Python26\lib\site-packages\pycrypto-2.0.1-py2.6-win32.egg
# zipimport: found 60 names in
C:\Python26\lib\site-packages\mechanize-0.1.11-py2.6.egg
# zipimport: found 7 names in
C:\Python26\lib\site-packages\clientform-0.2.10-py2.6.egg
# zipimport: found 14 names in
C:\Python26\lib\site-packages\modulegraph-0.7.3-py2.6.egg
# C:\Python26\lib\locale.pyc matches C:\Python26\lib\locale.py
import locale # precompiled from C:\Python26\lib\locale.pyc
import encodings # directory C:\Python26\lib\encodings
# C:\Python26\lib\encodings\__init__.pyc matches
C:\Python26\lib\encodings\__init__.py
import encodings # precompiled from C:\Python26\lib\encodings\__init__.pyc
# C:\Python26\lib\codecs.pyc matches C:\Python26\lib\codecs.py
import codecs # precompiled from C:\Python26\lib\codecs.pyc
import _codecs # builtin
# C:\Python26\lib\encodings\aliases.pyc matches
C:\Python26\lib\encodings\aliases.py
import encodings.aliases # precompiled from
C:\Python26\lib\encodings\aliases.pyc
# C:\Python26\lib\functools.pyc matches C:\Python26\lib\functools.py
import functools # precompiled from C:\Python26\lib\functools.pyc
import _functools # builtin
import _locale # builtin
# C:\Python26\lib\re.pyc matches C:\Python26\lib\re.py
import re # precompiled from C:\Python26\lib\re.pyc
# C:\Python26\lib\sre_compile.pyc matches C:\Python26\lib\sre_compile.py
import sre_compile # precompiled from C:\Python26\lib\sre_compile.pyc
import _sre # builtin
# C:\Python26\lib\sre_parse.pyc matches C:\Python26\lib\sre_parse.py
import sre_parse # precompiled from C:\Python26\lib\sre_parse.pyc
# C:\Python26\lib\sre_constants.pyc matches C:\Python26\lib\sre_constants.py
import sre_constants # precompiled from C:\Python26\lib\sre_constants.pyc
import operator # builtin
# C:\Python26\lib\encodings\cp1252.pyc matches
C:\Python26\lib\encodings\cp1252.py
import encodings.cp1252 # precompiled from
C:\Python26\lib\encodings\cp1252.pyc
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
File "utils\Build.py", line 22, in <module>
import PyInstaller.build
ImportError: No module named PyInstaller.build
# clear __builtin__._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.exitfunc
# clear sys.exc_type
# clear sys.exc_value
# clear sys.exc_traceback
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# clear sys.path_hooks
# clear sys.path_importer_cache
# clear sys.meta_path
# clear sys.flags
# clear sys.float_info
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup __main__
# cleanup[1] locale
# cleanup[1] functools
# cleanup[1] encodings
# cleanup[1] site
# cleanup[1] operator
# cleanup[1] abc
# cleanup[1] sre_constants
# cleanup[1] re
# cleanup[1] _codecs
# cleanup[1] nt
# cleanup[1] _warnings
# cleanup[1] zipimport
# cleanup[1] encodings.cp1252
# cleanup[1] codecs
# cleanup[1] _functools
# cleanup[1] _locale
# cleanup[1] signal
# cleanup[1] encodings.aliases
# cleanup[1] exceptions
# cleanup[1] sre_compile
# cleanup[1] _sre
# cleanup[1] sre_parse
# cleanup[2] copy_reg
# cleanup[2] types
# cleanup[2] errno
# cleanup[2] _abcoll
# cleanup[2] ntpath
# cleanup[2] genericpath
# cleanup[2] stat
# cleanup[2] warnings
# cleanup[2] UserDict
# cleanup[2] os.path
# cleanup[2] linecache
# cleanup[2] os
# cleanup sys
# cleanup __builtin__
# cleanup ints: 1635 unfreed ints
# cleanup floats
Regards
--
Florian Höch
Am 01.03.2011 21:17, schrieb Hartmut Goebel:
Am 01.03.2011 20:22, schrieb Florian Höch:
Please mind the -v switch. I want to see, where your python looks forpython -v utils\Build.py
Ah, ok.
PyInstaller.build.
Ok, here is the complete output:
python -v -c 'import PyInstaller.bindepend'
does not. According to <http://docs.python.org/tutorial/modules.html#the-module-search-path> this should work.python -v utils\Build.py
and start it using the switches -s and -S (do avoid loading site.py):import sys, os print os.getcwd() print sys.path
You may also check the output ofpython -sS utils\Build.py
Anything helpful there?python -sSc 'import sys; print sys.path'
So I can only imagine, either the current dir is different or sys.path is different.
works, but this put "" (the current dir) on sys.pathPYTHONPATH= python -sS utils/Build.py
Now this fails as you experienced.$ PYTHONPATH=/tmp python -sS utils/Build.py Traceback (most recent call last): File "utils/Build.py", line 22, in <module> import PyInstaller.build ImportError: No module named PyInstaller.build
Then we'll think about a solution :-)
try:
import PyInstaller
except ImportError:
import imp, os
imp.load_module('PyInstaller', *imp.find_module('PyInstaller', ["."]))
imp.load_module('hooks', *imp.find_module('hooks', ["."]))
(The 'hooks' line is required since 'hooks' are imported, too :-(
Yes, it's working now :)
Regards
--
Florian Höch