python NameError: global name '__file__' is not defined?

When I run this code in python 2.7, I get this error: Traceback (most recent call last): File "C:\Python26\Lib\site...

python NameError: global name '__file__' is not defined?

When I run this code in python 2.7, I get this error: Traceback (most recent call last): File "C:\Python26\Lib\site...