Message220196
It is not when freezing the logging package, so any use of the logging package fails:
>>> import logging
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "<pyrun>/importlib/_bootstrap.py", line 2237, in _find_and_load
File "<pyrun>/importlib/_bootstrap.py", line 2226, in _find_and_load_unlocked
File "<pyrun>/importlib/_bootstrap.py", line 1200, in _load_unlocked
File "<pyrun>/importlib/_bootstrap.py", line 1129, in _exec
File "<pyrun>/importlib/_bootstrap.py", line 1359, in exec_module
File "<pyrun>/logging/__init__.py", line 61, in <module>
NameError: name '__file__' is not defined
This is the code in question:
#
# _srcfile is used when walking the stack to check when we've got the first
# caller stack frame.
#
if hasattr(sys, 'frozen'): #support for py2exe
_srcfile = "logging%s__init__%s" % (os.sep, __file__[-4:])
else:
_srcfile = __file__
_srcfile = os.path.normcase(_srcfile)
Note the special case for py2exe. But this doesn't really help, since frozen modules don't have the __file__ attribute set - at least not when generated with Tools/freeze.
PS: This is with Python 3.4.1. |
|
Date |
User |
Action |
Args |
2014-06-10 21:15:54 | lemburg | set | recipients:
+ lemburg |
2014-06-10 21:15:54 | lemburg | set | messageid: <1402434954.06.0.638044906796.issue21709@psf.upfronthosting.co.za> |
2014-06-10 21:15:54 | lemburg | link | issue21709 messages |
2014-06-10 21:15:53 | lemburg | create | |
|