Python system apps must hardcode system python in #! line

Bug #137985 reported by Barry Warsaw
4
Affects Status Importance Assigned to Milestone
gnome-app-install
Fix Released
Undecided
Michael Vogt

Bug Description

I just attempted an upgrade from feisty to gutsy, but this upgrade eventually failed with an import error:

Setting up gnome-app-install (0.4.8-0ubuntu1) ...
Traceback (most recent call last):
  File "/usr/sbin/update-app-install", line 3, in <module>
    from AppInstall.update import main
ImportError: No module named AppInstall.update
dpkg: error processing gnome-app-install (--configure):
 subprocess post-installation script returned error exit status 1

It strikes me that I've seen this probably before with incorrectly written system applications. See for example this bug:

https://bugs.launchpad.net/bzr/+bug/134046

The problem will often hit Python developers such as myself. While it is generally correct to recommend that the #! line for development packages be

#! /usr/bin/env python

it is actually /incorrect/ to use this line in system tools because if I have a development Python in my $PATH, the tool will break. The expected packages won't be present in my dev Python's site-packages.

In fact, Python's own distutils/setuptools package manager hardcodes the #! line to the version of Python you use to install the package, even if the original script has /usr/bin/env in it. This is always the correct thing to do.

In short: system tools /must always/ use the system python.

Michael Vogt (mvo)
Changed in gnome-app-install:
assignee: nobody → mvo
status: New → Fix Committed
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Fixed in 0.4.10-0ubuntu1

Changed in gnome-app-install:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.