Title: setuptools: 'NoneType' object has no attribute 'startswith'
Type: Severity: major
Components: Core Versions: 2.5alpha1
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: nriley, thijs
Priority: Keywords:

Created on 2008-07-16.03:11:00 by thijs, last changed 2008-08-01.22:30:07 by nriley.

msg3331 (view) Author: Thijs Triemstra (thijs) Date: 2008-07-16.03:10:59
When trying to install setuptools 0.6c8 on jython2.5a1+ (mac osx 10.5.4/jdk 
1.5) I'm getting an error. How to reproduce:

 - Get the installer from
 - Install it (in my case in ~/Sites/jython2.5a1+)
 - cd ~/Sites/jython2.5a1+
 - wget
 - ./jython
 - Results in the following error:

Traceback (most recent call last):
  File "", line 267, in <module>
  File "", line 200, in main
    from setuptools.command.easy_install import main
  File "~Sites/jython2.5a1+/setuptools-0.6c8-
py2.5.egg/setuptools/", line 2, in <module>
  File "~/jython2.5a1+/setuptools-0.6c8-py2.5.egg/setuptools/", 
line 2, in <module>
  File "~/Sites/jython2.5a1+/setuptools-0.6c8-py2.5.egg/setuptools/", 
line 5, in <module>
  File "~/Sites/jython2.5a1+/setuptools-0.6c8-
py2.5.egg/setuptools/command/", line 2, in <module>
  File "~a/Sites/jython2.5a1+/Lib/distutils/command/", line 15, in 
    from distutils.sysconfig import get_config_vars
  File "~/Sites/jython2.5a1+/Lib/distutils/", line 29, in 
    argv0_path = os.path.dirname(os.path.abspath(sys.executable))
  File "~/Sites/jython2.5a1+/Lib/", line 410, in abspath
    if not isabs(path):
  File "~/Sites/jython2.5a1+/Lib/", line 51, in isabs
    return s.startswith('/')
AttributeError: 'NoneType' object has no attribute 'startswith'
msg3337 (view) Author: Nicholas Riley (nriley) Date: 2008-07-16.16:56:12
I'm able to reproduce this.  sys.executable is not being set even though the 
launcher script sets the corresponding system property (-Dpython.executable=...)

Try changing the last line of the "jython" script to the following:

"/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/java" -
Dpython.home="/Users/xxx/Sites/jython2.5a1+" -classpath "$CP" 
org.python.util.jython -Dpython.executable="$0" "$@"

(replacing xxx with the directory where you have it installed).

-D arguments after the class specification are parsed by Jython rather than by the 
VM, and setting python.executable there works.

Another option (assuming you don't use it) is to move away or delete the "registry" 

There are so many places to set Jython options (system properties, registry, 
Python-specific command line options, Jython-parsed -D options, and soon 
environment variables) it is really unclear how precedence should work; we should 
document this and make sure it's properly tested.
msg3347 (view) Author: Thijs Triemstra (thijs) Date: 2008-07-17.16:55:02
hi nreiley, I'm not sure it's the same issue because the contents of my 
'jython' script already looks like the one you suggested (unless I'm 
missing something):


# This file was generated by the Jython installer
# Created on Tue Jul 15 22:36:25 CEST 2008 by thijstriemstra

if [ ! -z "$CLASSPATH" ]
a" -Dpython.home="/Users/thijstriemstra/Sites/jython2.5a1+" -
Dpython.executable="$0" -classpath "$CP" org.python.util.jython "$@"
msg3348 (view) Author: Nicholas Riley (nriley) Date: 2008-07-17.17:00:19
The important part is moving '-Dpython.executable="$0"' after 
'org.python.util.jython' in the script; the distributed script has it 
msg3388 (view) Author: Nicholas Riley (nriley) Date: 2008-08-01.22:30:07
Fixed in r5047.  Working on the precedence issues, but it turned out 
python.executable was a special case.
Date User Action Args
2008-08-01 22:30:07nrileysetstatus: open -> closed
resolution: fixed
messages: + msg3388
2008-07-17 17:00:19nrileysetmessages: + msg3348
2008-07-17 16:55:03thijssetmessages: + msg3347
2008-07-16 17:30:53nrileylinkissue1073 superseder
2008-07-16 16:56:13nrileysetnosy: + nriley
messages: + msg3337
severity: normal -> major
2008-07-16 03:11:00thijscreate