[IPython-user] "run" magic command bug

Garaga Alexander algaraga@yandex...
Fri Oct 12 02:29:27 CDT 2007

I found a problem with the "run" magic command which violates its documentation, namely this excerpt:
    The file is executed in a namespace initially consisting only of
    __name__=='__main__' and sys.argv constructed as indicated. It thus
    sees its environment as if it were being run as a stand-alone

Here is my ipython session (uses pysh module):
agaraga@nstmklel16[tmp]|3> cat ma.py
agaraga@nstmklel16[tmp]|4> import ma
agaraga@nstmklel16[tmp]|5> ma.a = 1000
agaraga@nstmklel16[tmp]|7> cat 2.py
import ma
print ma.a

agaraga@nstmklel16[tmp]|8> run 2.py


As we see the changes made in the module "ma" namespace are actually visible from the program "2.py".

More information about the IPython-user mailing list