Can't get the IPYthon ipapi object working

2009-02-18 Thread beetlecube
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' '

If I remove the ip.options statement, it will say the same thing about
attribute 'ex'

Does anyone know if there are configuration options necessary?

 I read the docs, and it described a profile module, but I just need
to run this, for this single purpose ( at least, now, later I can see
its usefulness definitely,)

Steve











--
http://mail.python.org/mailman/listinfo/python-list


Re: Can't get the IPYthon ipapi object working

2009-02-18 Thread beetlecube
On Feb 18, 3:12 pm, Robert Kern  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

--
http://mail.python.org/mailman/listinfo/python-list