[IPython-user] exception with help()

Thorsten Kampe thorsten at thorstenkampe.de
Sat Mar 6 07:09:03 CST 2004


Following error with "help(abs)" (and any other help()" in IPython
(Cygwin under Windows XP SP1; all Windows patches and Cygwin
uptodate):

,---
| thorsten at galactus% ipython
| Python 2.3.3 (#1, Dec 30 2003, 08:29:25) 
| Type "copyright", "credits" or "license" for more information.
| 
| IPython 0.5.0 -- 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.
| 1% help(abs)
|       8 [main] python2.3 2356 sync_with_child: child 2524(0x6C4) died before initialization with status code 0x1
|   16249 [main] python2.3 2356 sync_with_child: *** child state child loading dlls
| ---------------------------------------------------------------------------
| OSError                                   Traceback (most recent call last)
| 
| /home/thorsten/<console> 
| 
| /tmp/python.2664/usr/lib/python2.3/site.py in __call__(self=Type help() for interactive help, or help(object) for help about object., *args=(<built-in function abs>,), **kwds={})
|     307     def __call__(self, *args, **kwds):
|     308         import pydoc
| --> 309         return pydoc.help(*args, **kwds)
|         pydoc = <module 'pydoc' from '/usr/lib/python2.3/pydoc.pyc'>, global help = undefined, args = (<built-in function abs>,), kwds = {}
|     310 
|     311 __builtin__.help = _Helper()
| 
| /tmp/python.2664/usr/lib/python2.3/pydoc.py in __call__(self=<pydoc.Helper instance>, request=<built-in function abs>)
|    1545     def __call__(self, request=None):
|    1546         if request is not None:
| -> 1547             self.help(request)
|         self = <pydoc.Helper instance>, global help = <pydoc.Helper instance>, request = <built-in function abs>
|    1548         else:
|    1549             self.intro()
| 
| /tmp/python.2664/usr/lib/python2.3/pydoc.py in help(self=<pydoc.Helper instance>, request=<built-in function abs>)
|    1581             elif request: doc(request, 'Help on %s:')
|    1582         elif isinstance(request, Helper): self()
| -> 1583         else: doc(request, 'Help on %s:')
|         global doc = <function doc>, request = <built-in function abs>
|    1584         self.output.write('\n')
|    1585 
| 
| /tmp/python.2664/usr/lib/python2.3/pydoc.py in doc(thing=<built-in function abs>, title='Help on %s:', forceload=0)
|    1375         pager(title % desc + '\n\n' + text.document(object, name))
|    1376     except (ImportError, ErrorDuringImport), value:
| -> 1377         print value
|         value = undefined
|    1378 
|    1379 def writedoc(thing, forceload=0):
| 
| /tmp/python.2664/usr/lib/python2.3/pydoc.py in pager(text='Help on built-in function abs:\n\na\x08ab\x08bs\x08s(...)\n ... \n    Return the absolute value of the argument.\n')
|    1209     global pager
|    1210     pager = getpager()
| -> 1211     pager(text)
|         global pager = <function <lambda>>, text = 'Help on built-in function abs:\n\na\x08ab\x08bs\x08s(...)\n ... \n    Return the absolute value of the argument.\n'
|    1212 
|    1213 def getpager():
| 
| /tmp/python.2664/usr/lib/python2.3/pydoc.py in <lambda>(text='Help on built-in function abs:\n\na\x08ab\x08bs\x08s(...)\n ... \n    Return the absolute value of the argument.\n')
|    1229         return lambda text: tempfilepager(plain(text), 'more <')
|    1230     if hasattr(os, 'system') and os.system('(less) 2>/dev/null') == 0:
| -> 1231         return lambda text: pipepager(text, 'less')
|         text = 'Help on built-in function abs:\n\na\x08ab\x08bs\x08s(...)\n ... \n    Return the absolute value of the argument.\n', global pipepager = <function pipepager>
|    1232 
|    1233     import tempfile
| 
| /tmp/python.2664/usr/lib/python2.3/pydoc.py in pipepager(text='Help on built-in function abs:\n\na\x08ab\x08bs\x08s(...)\n ... \n    Return the absolute value of the argument.\n', cmd='less')
|    1248 def pipepager(text, cmd):
|    1249     """Page through text by feeding it to another program."""
| -> 1250     pipe = os.popen(cmd, 'w')
|         pipe = undefined, global os = <module 'os' from '/usr/lib/python2.3/os.pyc'>, global popen = undefined, cmd = 'less'
|    1251     try:
|    1252         pipe.write(text)
| 
| OSError: [Errno 11] Resource temporarily unavailable
| 2% 
`---

Appearently a problem with less. less is version 3.81 and works
perfectly under Cygwin and even under Windows. I crosschecked on my
Gentoo Linux box and there I have no problems. Under Gentoo IPython
uses the 'most' pager (because PAGER/MANPAGER) - but it even works
when I export PAGER as 'less'. The standard Python shell under Cygwin
doesn't have the problem (but uses less instead of most, too, like
IPython tries to). The shell and Python configuration files (.inputrc,
.zshrc, .bashrc, ipythonrc and .pythonrc.py are exactly the same on
all hosts).

So there are in fact two problems

1. Why does an exception occur with less?
2. Why does IPython try to use less (instead of most)?


Thorsten



More information about the IPython-user mailing list