pyinstaller and logging

Mike tornadomaker at gmx.net
Wed May 6 09:41:12 EDT 2009


Pyinstaller seems to have a problem with logging ...

 I installed pyinstaller 1.3 - using it together with Python 2.6. I
used pyinstaller for a small project, the created .exe worked fine.
After some additional changes to my project I got strange run time
errors when running the .exe (but no problems when running the .py
file directly with the python interpreter). I stripped down my program
and tracked the problem down to the first log message being written.

So this is a stripped down version of the python script:

import logging
logging.basicConfig(level=logging.INFO,
                    format='%(asctime)-15s %(levelname)-8s %(message)
s',
                    datefmt='%Y-%m-%d %H:%M:%S',
                    filename="test1.log",
                    filemode='w')
print "written via print"
logging.info("written via logging")

when I start this from the python shell I am getting
           IDLE 2.6.2      ==== No Subprocess ====
           >>>
           written via print
           >>>
and test1.log contains
           2009-05-05 19:39:52 INFO     written via logging
as expected.

When I start test1.exe I am getting

written via print
Traceback (most recent call last):
  File "<string>", line 8, in <module>
  File "c:\dokumente und einstellungen\dieter\eigene dateien\collector
\v0r0m2\buildtest1\out1.pyz/logging", line 1451, in info
  File "c:\dokumente und einstellungen\dieter\eigene dateien\collector
\v0r0m2\buildtest1\out1.pyz/logging", line 1030, in info
  File "c:\dokumente und einstellungen\dieter\eigene dateien\collector
\v0r0m2\buildtest1\out1.pyz/logging", line 1142, in _log
  File "c:\dokumente und einstellungen\dieter\eigene dateien\collector
\v0r0m2\buildtest1\out1.pyz/logging", line 1117, in makeRecord
  File "c:\dokumente und einstellungen\dieter\eigene dateien\collector
\v0r0m2\buildtest1\out1.pyz/logging", line 272, in __init__
  File "C:\Programme\pyinstaller-1.3\iu.py", line 312, in importHook
    mod = _self_doimport(nm, ctx, fqname)
  File "C:\Programme\pyinstaller-1.3\iu.py", line 398, in doimport
    exec co in mod.__dict__
  File "c:\dokumente und einstellungen\dieter\eigene dateien\collector
\v0r0m2\buildtest1\out1.pyz/multiprocessing", line 83, in <module>
  File "C:\Programme\pyinstaller-1.3\iu.py", line 312, in importHook
    mod = _self_doimport(nm, ctx, fqname)
  File "C:\Programme\pyinstaller-1.3\iu.py", line 382, in doimport
    mod = director.getmod(nm)
  File "C:\Programme\pyinstaller-1.3\iu.py", line 215, in getmod
    mod = owner.getmod(nm)
  File "C:\Programme\pyinstaller-1.3\iu.py", line 77, in getmod
    mod = imp.load_module(nm, fp, attempt, (ext, mode, typ))
TypeError: importHook() takes at most 5 arguments (6 given)

What am I doing wrong?



More information about the Python-list mailing list