Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #2341

Re: A problem about ipython

From "eryksun ()" <eryksun@gmail.com>
Newsgroups comp.lang.python
Subject Re: A problem about ipython
Date 2011-04-01 02:11 -0700
Organization http://groups.google.com
Message-ID <8530f617-ac64-46e4-8d02-ebfeb88d137e@glegroupsg2000goo.googlegroups.com> (permalink)

Show all headers | View raw


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())

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: A problem about ipython "eryksun ()" <eryksun@gmail.com> - 2011-04-01 02:11 -0700
  Re: A problem about ipython Vincent Ren <renws1990@gmail.com> - 2011-04-02 15:18 -0700

csiph-web