A problem about ipython
eryksun ()
eryksun at gmail.com
Fri Apr 1 05:11:41 EDT 2011
On Thursday, March 31, 2011 9:48:27 PM UTC-4, Vincent Ren wrote:
>
> when I run this(from Programming Python 3rd) in ipython, I'll
> get a NameError:
> ....
>
> /usr/lib/python2.6/profile.pyc in runctx(self, cmd, globals, locals)
> 460 sys.setprofile(self.dispatcher)
> 461 try:
> --> 462 exec cmd in globals, locals
> 463 finally:
> 464 sys.setprofile(None)
>
> /usr/lib/pymodules/python2.6/IPython/FakeModule.pyc in <module>()
>
> NameError: name 'timer' is not defined
> ....
> What's going wrong here?
Try this instead:
profile.runctx('timer.test(100, settime.setops, set.Set)', globals=globals(), locals=locals())
More information about the Python-list
mailing list