[IPython-dev] access to __file__

Vivian De Smedt vds at aisystems.be
Wed Jan 11 03:59:40 CST 2006


Fernando,

I use the svn version of IPython and I notice a small difference between
python brol.py and IPython run brol.py.

It seems that IPython run brol.py do not have access to the special
__file__ attribute of the brol.py module.

To be more explicit suppose you have a brol.py file:
print __file__

python brol.py produce:
brol.py

IPython run brol.py produce:
---------------------------------------------------------------------------
exceptions.NameError                                 Traceback (most
recent call last)

C:\Documents and Settings\vds.AISYSTEMS\Desktop\brol.py
     -3 print __file__

NameError: name '__file__' is not defined
WARNING: Failure executing file: <brol.py>

I'm not hundred percent sure but I'm pretty sure this is new for IPython.

Kindest regards,
Vivian.




More information about the IPython-dev mailing list