[IPython-dev] cProfile and iPython
Benjamin Root
ben.v.root at gmail.com
Fri Jul 2 11:41:14 EDT 2010
Hello,
I have found an odd bug when I used cProfile in an iPython shell. It seems
to not load the same environment as the shell. The following is a very
simple example:
import cProfile
import math
x = 25
cProfile.run("y = math.sqrt(x)")
This throws an exception "NameError: name 'math' is not defined"
Similar problems occur if I define a function "foo" and call that in run. I
should also note that using "run -p" works just fine for a cProfile-less
version of the above script. I am using a stock install of python 2.6.5 and
ipython 0.10 on Ubuntu 10.04.
Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20100702/3b633583/attachment.html>
More information about the IPython-dev
mailing list