Issue1357

classification
Title: no sys.executable when script runner is a relative link
Type: Severity: normal
Components: Versions: 25rc4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: otmarhumbel, pjenvey, r_walter
Priority: Keywords: patch

Created on 2009-05-26.20:57:03 by r_walter, last changed 2009-05-26.21:57:59 by pjenvey.

Files
File name Uploaded Description Edit Remove
runner_rel_symlink.diff pjenvey, 2009-05-26.21:42:12
Messages
msg4720 (view) Author: Roland Walter (r_walter) Date: 2009-05-26.20:57:02
Below you see the output from an interactive session that followed the
instructions given by the jython interpreter. I would expect that typing
help() at the interpreter prompt would give me some help, instead of a
tracelog of a missing method/attribute on an object used in posixpath.py.

roland@dios:~> jython2.5
*sys-package-mgr*: processing new jar, '/usr/local/jython2.5rc3/jython.jar'
Jython 2.5rc3 (Release_2_5rc3:6384:6385, May 26 2009, 15:51:41)
[Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_13
Type "help", "copyright", "credits" or "license" for more information.
>>> help
Type help() for interactive help, or help(object) for help about object.
>>> hellp()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'hellp' is not defined
>>> help()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/jython2.5rc3/Lib/site.py", line 348, in __call__
    import pydoc
  File "/usr/local/jython2.5rc3/Lib/pydoc.py", line 1812, in <module>
    help = Helper(sys.stdin, sys.stdout)
  File "/usr/local/jython2.5rc3/Lib/pydoc.py", line 1626, in __init__
    execdir = os.path.dirname(sys.executable)
  File "/usr/local/jython2.5rc3/Lib/posixpath.py", line 122, in dirname
    return split(p)[0]
  File "/usr/local/jython2.5rc3/Lib/posixpath.py", line 80, in split
    i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
>>>
msg4721 (view) Author: Philip Jenvey (pjenvey) Date: 2009-05-26.21:02:48
You're not using the provided command line script, it passes the sys. 
executable name into Jython. This is caused by sys.executable being None
msg4722 (view) Author: Roland Walter (r_walter) Date: 2009-05-26.21:07:39
Sorry, I am using the provided script.

roland@dios:~> which jython2.5
/usr/local/bin/jython2.5
roland@dios:~> ls -l /usr/local/bin/jython2.5
lrwxrwxrwx 1 root root 22 26. Mai 22:48 /usr/local/bin/jython2.5 ->
../jython2.5rc3/jython
roland@dios:~>
msg4723 (view) Author: Roland Walter (r_walter) Date: 2009-05-26.21:09:48
This is a bug, I would suggest reopen it, or you should forbid to use
link for using the startup script.
msg4724 (view) Author: Philip Jenvey (pjenvey) Date: 2009-05-26.21:10:57
Does running the original script directly make any difference?
msg4725 (view) Author: Roland Walter (r_walter) Date: 2009-05-26.21:15:19
In python2.5 you are allowed to call python with a link, and you may
call help() then:

roland@dios:~> which python
/usr/bin/python
roland@dios:~> ls -l /usr/bin/python
lrwxrwxrwx 1 root root 9  9. Jan 19:52 /usr/bin/python -> python2.5
roland@dios:~> python
Python 2.5.2 (r252:60911, Dec  1 2008, 17:47:46)
[GCC 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> help
Type help() for interactive help, or help(object) for help about object.
>>> help()

Welcome to Python 2.5!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://www.python.org/doc/tut/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help>
msg4726 (view) Author: Roland Walter (r_walter) Date: 2009-05-26.21:16:55
Using the script directly, and not with a link works.
msg4727 (view) Author: Oti Humbel (otmarhumbel) Date: 2009-05-26.21:22:45
I get the same error in standalone mode, when starting as follows:
 java -jar jython.jar
msg4728 (view) Author: Roland Walter (r_walter) Date: 2009-05-26.21:34:49
The problem is the relative path used as link.

../jython2.5rc5/jython

When using the absolut path instead

/usr/local/jython2.5rc5/jython

it works.
msg4729 (view) Author: Philip Jenvey (pjenvey) Date: 2009-05-26.21:42:12
That's right, can you switch back to the relative path, apply this patch 
to the original script and let us know if this solves the issue?

Thanks
msg4730 (view) Author: Roland Walter (r_walter) Date: 2009-05-26.21:52:34
Now the relative link works.

roland@dios:~> which jython2.5
/usr/local/bin/jython2.5
roland@dios:~> ls -l /usr/local/bin/jython2.5
lrwxrwxrwx 1 root root 22 26. Mai 23:50 /usr/local/bin/jython2.5 ->
../jython2.5rc3/jython
roland@dios:~> jython2.5
Jython 2.5rc3 (Release_2_5rc3:6384:6385, May 26 2009, 15:51:41)
[Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_13
Type "help", "copyright", "credits" or "license" for more information.
>>> help()

Welcome to Python 2.5!  This is the online help utility.

<cut>
msg4731 (view) Author: Philip Jenvey (pjenvey) Date: 2009-05-26.21:54:03
Thanks Roland, how does the rest of the tutorial go? Let us know if 
there's any other problems with it
msg4732 (view) Author: Philip Jenvey (pjenvey) Date: 2009-05-26.21:57:59
applied in r6387
History
Date User Action Args
2009-05-26 21:57:59pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg4732
2009-05-26 21:56:10pjenveysettitle: jython2.5rc3 interactive help() does not work -> no sys.executable when script runner is a relative link
2009-05-26 21:54:03pjenveysetmessages: + msg4731
2009-05-26 21:52:34r_waltersetmessages: + msg4730
2009-05-26 21:42:12pjenveysetfiles: + runner_rel_symlink.diff
keywords: + patch
messages: + msg4729
2009-05-26 21:34:49r_waltersetmessages: + msg4728
2009-05-26 21:22:45otmarhumbelsetnosy: + otmarhumbel
messages: + msg4727
2009-05-26 21:16:55r_waltersetmessages: + msg4726
2009-05-26 21:15:19r_waltersetmessages: + msg4725
2009-05-26 21:11:05pjenveysetstatus: closed -> open
resolution: invalid -> (no value)
2009-05-26 21:10:57pjenveysetmessages: + msg4724
2009-05-26 21:09:48r_waltersetmessages: + msg4723
2009-05-26 21:07:39r_waltersetmessages: + msg4722
2009-05-26 21:02:48pjenveysetstatus: open -> closed
resolution: invalid
messages: + msg4721
nosy: + pjenvey
2009-05-26 20:57:04r_waltercreate