[IPython-user] interactive help question

Arnd Baecker arnd.baecker at web.de
Tue Mar 2 05:25:46 CST 2004


Hi,

When I do the following on a "normal" python prompt
##############
def add_xy(x,y):
    """return sum of x and y
    """
    return(x+y)

help(add_xy)
##############

I get the expected help.
However for Ipython I end up with a KeyError.
(full screen-shot below).
I did not start any digging yet
(and have to leave this for tomorrow ...)

Arnd

P.S: for those who have seen the bunch of my mails on scipy-user:
     yes - I am after the pain-of-the-day award ;-)


"Screen-Shot":

Python 2.3 (#1, Sep 19 2003, 08:58:21)
Type "copyright", "credits" or "license" for more information.

IPython 0.5.1.cvs -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
@magic  -> Information about IPython's 'magic' @ functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: def add_xy(x,y):
   ...:     """return sum of x and y
   ...:     """
   ...:     return(x+y)
   ...:

In [2]: help(add_xy)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call
last)

/home/abaecker/<console>

/home/python/PYTHON/lib/python2.3/site.py in __call__(self, *args, **kwds)
    292     def __call__(self, *args, **kwds):
    293         import pydoc
--> 294         return pydoc.help(*args, **kwds)
    295
    296 __builtin__.help = _Helper()

/home/python/PYTHON/lib/python2.3/pydoc.py in __call__(self, request)
   1545     def __call__(self, request=None):
   1546         if request is not None:
-> 1547             self.help(request)
   1548         else:
   1549             self.intro()

/home/python/PYTHON/lib/python2.3/pydoc.py in help(self, request)
   1581             elif request: doc(request, 'Help on %s:')
   1582         elif isinstance(request, Helper): self()
-> 1583         else: doc(request, 'Help on %s:')
   1584         self.output.write('\n')
   1585

/home/python/PYTHON/lib/python2.3/pydoc.py in doc(thing, title, forceload)
   1375         pager(title % desc + '\n\n' + text.document(object, name))
   1376     except (ImportError, ErrorDuringImport), value:
-> 1377         print value
   1378
   1379 def writedoc(thing, forceload=0):

/home/python/PYTHON/lib/python2.3/site-packages/IPython/FakeModule.py in
__getattr__(self, key)
     23
     24     def __getattr__(self,key):
---> 25         return self.__dict__[key]
     26
     27     def __str__(self):

KeyError: '__nonzero__'

In [3]: help.__module__
Out[3]: 'site'




More information about the IPython-user mailing list