[Ipython-tickets] [IPython] #197: %run doesn't doesn't update from file correctly with use of IPShellEmbed
IPython
ipython-tickets@scipy....
Sun Nov 11 10:17:26 CST 2007
#197: %run doesn't doesn't update from file correctly with use of IPShellEmbed
---------------------------------------+------------------------------------
Reporter: quadri@strw.leidenuniv.nl | Owner: fperez
Type: defect | Status: new
Priority: high | Milestone:
Component: ipython | Version:
Severity: normal | Keywords:
---------------------------------------+------------------------------------
I was testing some code using %run, then I would modify the code, and run
it again, but the new output wouldn't reflect the changes that I'd made.
It appears that the problem is the way that I'm using IPShellEmbed. Here
is a simple example of the problem, making use of a file called test.py:
{{{
In [1]: cat test.py
x=3
from IPython.Shell import IPShellEmbed
ipshell = IPShellEmbed()
def func():
return x
In [2]: %run test
In [3]: x
Out[3]: 3
In [4]: func()
Out[4]: 3
############ now edit the file so that x=4 ##############
In [5]: %run test
In [6]: x
Out[6]: 3
In [7]: func()
Out[7]: 3
}}}
However, if I comment out the line "ipshell = IPShellEmbed()" in test.py,
restart ipython, and repeat the procedure shown above, then last few
input/output look like this (which I believe is the correct behavior):
{{{
############ now edit the file so that x=4 ##############
In [5]: %run test
In [6]: x
Out[6]: 4
In [7]: func()
Out[7]: 4
}}}
As far as I can tell the problem is specific to IPShellEmbed(), since it
doesn't seem to occur when aliasing other functions. Also, it doesn't
seem to matter if x is declared inside of func(), or if the import command
occurs inside of func().
I'm using ipython 0.8.1, python 2.5.1, Mac OS 10.4.10 on a PPC.
--
Ticket URL: <http://ipython.scipy.org/ipython/ipython/ticket/197>
IPython <http://ipython.scipy.org>
The IPython interactive Python system
More information about the Ipython-tickets
mailing list