Issue1069

classification
Title: setuptools: 'NoneType' object has no attribute 'startswith'
Type: Severity: major
Components: Core Versions: 2.5alpha1
Milestone:
process
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.

Messages
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 http://downloads.sourceforge.net/jython/jython_installer-2.5a1.jar
 - Install it (in my case in ~/Sites/jython2.5a1+)
 - cd ~/Sites/jython2.5a1+
 - wget http://peak.telecommunity.com/dist/ez_setup.py
 - ./jython ez_setup.py
 - Results in the following error:

Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-
0.6c8-py2.5.egg
Traceback (most recent call last):
  File "ez_setup.py", line 267, in <module>
    main(sys.argv[1:])
  File "ez_setup.py", line 200, in main
    from setuptools.command.easy_install import main
  File "~Sites/jython2.5a1+/setuptools-0.6c8-
py2.5.egg/setuptools/__init__.py", line 2, in <module>
  File "~/jython2.5a1+/setuptools-0.6c8-py2.5.egg/setuptools/extension.py", 
line 2, in <module>
  File "~/Sites/jython2.5a1+/setuptools-0.6c8-py2.5.egg/setuptools/dist.py", 
line 5, in <module>
  File "~/Sites/jython2.5a1+/setuptools-0.6c8-
py2.5.egg/setuptools/command/install.py", line 2, in <module>
  File "~a/Sites/jython2.5a1+/Lib/distutils/command/install.py", line 15, in 
<module>
    from distutils.sysconfig import get_config_vars
  File "~/Sites/jython2.5a1+/Lib/distutils/sysconfig.py", line 29, in 
<module>
    argv0_path = os.path.dirname(os.path.abspath(sys.executable))
  File "~/Sites/jython2.5a1+/Lib/posixpath.py", line 410, in abspath
    if not isabs(path):
  File "~/Sites/jython2.5a1+/Lib/posixpath.py", 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" 
file.

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):

#!/bin/sh

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

CP="/Users/thijstriemstra/Sites/jython2.5a1+/jython-complete.jar"
if [ ! -z "$CLASSPATH" ]
then
  CP=$CP:$CLASSPATH
fi
"/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/jav
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 
before.
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.
History
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