This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Todd.Rovito, roger.serwy, terry.reedy
Date 2013-06-23.19:10:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This is a 2.7 only bug.

print (__file__)

__file__ should be set to relative or absolute path.

From command line:

F:\Python\mypy> c:/programs/python27/python.exe

F:\Python\mypy> c:/programs/python27/python.exe -m tem2

3.3 gives same results.

From Idle editor window with Run Module (F5):

3.3: >>>
# same as python -m above, and same as when file is imported.

2.7: >>>
Traceback (most recent call last):
  File "F:\Python\mypy\", line 1, in <module>
    print (__file__)
NameError: name '__file__' is not defined

This is the bug to be fixed, if reasonably possible.

Both 2.7 and 3.3 set __file__ on regular import (or rather, Idle does not disable this).

>>> import tem2

I think the first step should be to try this on non-Windows systems.
Date User Action Args
2013-06-23 19:10:49terry.reedysetrecipients: + terry.reedy, roger.serwy, Todd.Rovito
2013-06-23 19:10:49terry.reedysetmessageid: <>
2013-06-23 19:10:49terry.reedylinkissue18288 messages
2013-06-23 19:10:49terry.reedycreate