Can't get the IPYthon ipapi object working

beetlecube SiteContactUs at gmail.com
Wed Feb 18 19:29:09 EST 2009


On Feb 18, 3:12 pm, Robert Kern <robert.k... at gmail.com> wrote:
> On 2009-02-18 15:49, beetlecube wrote:
>
>
>
> > Hi , I found out from a random google search that I could use IPython
> > to automatically import modules so that I could test Django views.
>
> > I downloaded it (WIN XP), installed it.  I'm able to import it, but I
> > just can't seem to get the object working.
>
> > The code:
> > -----------------------------------
> > try:
> >      import IPython.ipapi
> >      ip = IPython.ipapi.get()
> >      a = ip.options
> >      ip.ex('import os')
>
> > except Exception,msg:
> >      print "Message: ", msg
> > -------------------------------------------
>
> > I get: ' Message:  'NoneType' object has no attribute 'options' '
>
Shoulda know I was doing something fundamentally wrong.
Thanks a lot!
> > If I remove the ip.options statement, it will say the same thing about
> > attribute 'ex'
>
> This needs to be run in the context of a running instance IPython, not just any
> other module. That kind of code is usually put into your c:\Documents and
> Settings\username\_ipython\ipy_user_conf.py file.
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless enigma
>   that is made terrible by our own mad attempt to interpret it as though it had
>   an underlying truth."
>    -- Umberto Eco




More information about the Python-list mailing list