[ python-Bugs-768391 ] hardcoded python paths

SourceForge.net noreply at sourceforge.net
Fri Jul 16 16:48:21 CEST 2004


Bugs item #768391, was opened at 2003-07-09 13:39
Message generated for change (Comment added) made by jackjansen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=768391&group_id=5470

Category: IDLE
Group: Python 2.3
>Status: Closed
>Resolution: Works For Me
Priority: 5
Submitted By: Tiago Castro Henriques (tiagoh)
Assigned to: Jack Jansen (jackjansen)
Summary: hardcoded python paths

Initial Comment:
I tried to use the new version of idle that is now
integrated into 2.3b2, but I got an error when I tried
to run /usr/local/lib/python2.3/idlelib/idle:

% /usr/local/lib/python2.3/idlelib/idle
Traceback (most recent call last):
  File "./idle", line 8, in ?
    import PyShell
  File "./PyShell.py", line 19, in ?
    from Tkinter import *
  File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 35,
in ?
    import _tkinter # If this fails your Python may not
be configured for Tk
ImportError: No module named _tkinter

I'm using python2.3b2 on MacOSX 10.2.6, compiled from
source with standard options.

Apparently the builtin 2.2 version of Python is being
used, even though $PYTHONHOME is not set (according to
the manpages, this should make it default to
/usr/local, and not /usr as seems to be the case).

This is due to the fact that this executable script
contains a shebang declaration with a hardcoded python
path:

% head -1 /usr/local/lib/python2.3/idlelib/idle
#!/usr/bin/python

This should be replaced by the standard shebang
declaration:
#! /usr/bin/env python

I checked to see if there were any other *.py files in
/usr/local/lib/python2.3 suffering from similar
problems, and found the following files to be affected:

/usr/local/lib/python2.3/cgi.py:
#! /usr/local/bin/python
/usr/local/lib/python2.3/test/test_bz2.py:
#!/usr/bin/python
/usr/local/lib/python2.3/test/test_largefile.py:
#!python
/usr/local/lib/python2.3/test/test_optparse.py:
#!/usr/bin/python

The files /usr/local/bin/idle, /usr/local/bin/pydoc and
/usr/local/bin/pycolor also have a hardcoded python path:
% head -1 idle pycolor pydoc
==> idle <==
#!/usr/local/bin/python

==> pycolor <==
#!/usr/local/bin/python

==> pydoc <==
#!/usr/local/bin/python

These should similarly be changed to #! /usr/bin/env python


----------------------------------------------------------------------

>Comment By: Jack Jansen (jackjansen)
Date: 2004-07-16 16:48

Message:
Logged In: YES 
user_id=45365

Idle on MacOSX isn't run from the commandline: you doubleclick the icon 
in the finder. And what gets launched then is an applet, which doesn't 
look at #! paths or anything.

If you want to run idle from the command line you could do that, but you 
would have to use #!/usr/bin/pythonw, not #!/usr/bin/python.

----------------------------------------------------------------------

Comment By: Kurt B. Kaiser (kbk)
Date: 2003-09-10 05:11

Message:
Logged In: YES 
user_id=149084

Refer to Python Bug 775061 (closed)

idlelib/idle  script has been removed since the
idle script is now in Tools/scripts and at least
the Linux installation is setting the shebang correctly.

Also, the shebang has been removed from idlelib/idle.py.

I don't know how OSX handles the script installation
so I'm referring this to Jack Jansen in case there is
a further problem.  How does IDLE start on OSX 
these days?  Is there any problem backporting the
deletions to 2.3 maint?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=768391&group_id=5470


More information about the Python-bugs-list mailing list