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


Groups > comp.lang.python > #2341 > unrolled thread

Re: A problem about ipython

Started by"eryksun ()" <eryksun@gmail.com>
First post2011-04-01 02:11 -0700
Last post2011-04-02 15:18 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  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

#2341 — Re: A problem about ipython

From"eryksun ()" <eryksun@gmail.com>
Date2011-04-01 02:11 -0700
SubjectRe: A problem about ipython
Message-ID<8530f617-ac64-46e4-8d02-ebfeb88d137e@glegroupsg2000goo.googlegroups.com>
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())

[toc] | [next] | [standalone]


#2474

FromVincent Ren <renws1990@gmail.com>
Date2011-04-02 15:18 -0700
Message-ID<83f4d526-eb99-4ea0-b4ed-660c5e2bc80a@j35g2000prb.googlegroups.com>
In reply to#2341
On Apr 1, 7:11 pm, "eryksun ()" <eryk...@gmail.com> wrote:

> Try this instead:
>
> profile.runctx('timer.test(100, settime.setops, set.Set)', globals=globals(), locals=locals())


It works! Thanks a lot

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web