[issue21709] logging.__init__ assumes that __file__ is always set

Marc-Andre Lemburg report at bugs.python.org
Wed Jun 11 10:46:02 CEST 2014


Marc-Andre Lemburg added the comment:

Hi Vinaj,

thanks for the patch, but it doesn't really help outside of py2exe. The sys.frozen flag is not an official Python API and it's unlikely to become one, since you can freeze the whole application or just parts of it, which sys.frozen would not be able to address.

Instead, the modules in the stdlib should be aware of the fact that __file__ is not always available and provide fallback solutions.

Could you please use a fix that works for Python tools in general ?

E.g. instead of doing an equal test inf .findCaller() it may be better to use a regular expression or you could patch the __init__ module's co_filename into the module as _srcfile (after it's fully initialized).

Thanks.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21709>
_______________________________________


More information about the Python-bugs-list mailing list