Hello,<br><br>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:<br><br>import cProfile<br>import math<br><br>
x = 25<br>cProfile.run("y = math.sqrt(x)")<br><br>This throws an exception "NameError: name 'math' is not defined"<br><br>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.<br>
<br>Ben Root<br><br><br>