Message5081

Author dhandy
Recipients dhandy
Date 2009-09-01.23:00:24
SpamBayes Score 2.22045e-16
Marked as misclassified No
Message-id <1251846025.52.0.144195867675.issue1452@psf.upfronthosting.co.za>
In-reply-to
Content
The built-in help() function fails with an exception. I traced the cause
to code in pydoc.py failing because sys.executable is None for the
stand-alone Jython.

C:\tools\jython2.5.1rc1>java -jar jython.jar
Jython 2.5.1rc1 (Release_2_5_1rc1:6736:6741, Sep 1 2009, 10:37:37)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_06
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
>>> help()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\home\davhan\tools\jython2.5.1rc1\jython.jar\Lib\site.py",
line 348, in __call__
  File "C:\home\davhan\tools\jython2.5.1rc1\jython.jar\Lib\pydoc.py",
line 1812, in <module>
  File "C:\home\davhan\tools\jython2.5.1rc1\jython.jar\Lib\pydoc.py",
line 1626, in __init__
  File "C:\home\davhan\tools\jython2.5.1rc1\jython.jar\Lib\ntpath.py",
line 209, in dirname
  File "C:\home\davhan\tools\jython2.5.1rc1\jython.jar\Lib\ntpath.py",
line 166, in split
  File "C:\home\davhan\tools\jython2.5.1rc1\jython.jar\Lib\ntpath.py",
line 121, in splitdrive
TypeError: 'NoneType' object is unsubscriptable

In a non-standalone Jython installation, sys.executable is set to the
path to jython.bat file, and the help() function works.

Here is a patch to pydoc.py that fixes this problem:
1626c1626,1629
<         execdir = os.path.dirname(sys.executable)
---
>         if sys.executable is None:
>             execdir = os.getcwd()
>         else:
>             execdir = os.path.dirname(sys.executable)
History
Date User Action Args
2009-09-01 23:00:25dhandysetrecipients: + dhandy
2009-09-01 23:00:25dhandysetmessageid: <1251846025.52.0.144195867675.issue1452@psf.upfronthosting.co.za>
2009-09-01 23:00:25dhandylinkissue1452 messages
2009-09-01 23:00:24dhandycreate