default of python 2.5 breaks CommandNotFound import

Bug #366096 reported by Michael Gundlach
2
Affects Status Importance Assigned to Milestone
command-not-found (Ubuntu)
Fix Released
Undecided
Michael Vogt

Bug Description

Binary package hint: command-not-found

mgundlach@ubuntu:~$ apt-cache policy command-not-found
command-not-found:
  Installed: 0.2.34ubuntu3
  Candidate: 0.2.34ubuntu3
  Version table:
 *** 0.2.34ubuntu3 0
        500 http://mirrors.rit.edu jaunty/main Packages
        100 /var/lib/dpkg/status

mgundlach@ubuntu:~$ lsb_release -rd
Description: Ubuntu 9.04
Release: 9.04

This is related to https://bugs.launchpad.net/ubuntu/+source/command-not-found/+bug/234540 , where setting python2.4 as the default on a python2.5 box broke CommandNotFound. Having just updated from Intrepid to Jaunty, and setting python2.5 as the default on my (suddenly) python2.6 box, CommandNotFound breaks.

mgundlach@ubuntu:~$ sudo rm /usr/bin/python && sudo ln -s /usr/bin/python2.5 /usr/bin/python
mgundlach@ubuntu:~$ l
Traceback (most recent call last):
  File "/usr/lib/command-not-found", line 8, in <module>
    import CommandNotFound
ImportError: No module named CommandNotFound
mgundlach@ubuntu:~$ sudo rm /usr/bin/python && sudo ln -s /usr/bin/python2.6 /usr/bin/python
mgundlach@ubuntu:~$ l
bash: l: command not found
mgundlach@ubuntu:~$

Interestingly, I tried modifying /usr/lib/command-not-found to use python2.6 explicitly instead of #!/usr/bin/python, and got the same behavior. I'm guessing that command-not-found is called somewhere within bash(?) as "python /usr/lib/command-not-found" instead of "/usr/lib/command-not-found" or "python2.6 /usr/lib/command-not-found".

Revision history for this message
Michael Gundlach (michaeltherobot) wrote :

With digging, I found the problem in /etc/bash.bashrc . A patch is attached that fixes the problem.

Revision history for this message
Florian Diesch (diesch) wrote :

Thanks for reporting this bug and any supporting documentation.

The Python package CommandNotFound is only installed for Python 2.6 but not for 2.5. As a workaround you can create a symlink:

 sudo ln -s /usr/lib/python2.6/dist-packages/CommandNotFound /usr/lib/python2.5/

Since this bug has enough information provided for a developer to begin work, I'm going to mark it as confirmed and let them handle it from here. Thanks for taking the time to make Ubuntu better!

Changed in command-not-found (Ubuntu):
status: New → Confirmed
Revision history for this message
Florian Diesch (diesch) wrote :

Your solution seems to be better :-)

Michael Vogt (mvo)
Changed in command-not-found (Ubuntu):
assignee: nobody → Michael Vogt (mvo)
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package command-not-found - 0.2.36ubuntu1

---------------
command-not-found (0.2.36ubuntu1) karmic; urgency=low

  * scan.data: updated to current karmic
  * scan.data: add exception for gftp (LP: #99708)
  * debian/postinst:
    - if old/leftover /etc/bash_command_found_found is there,
      remove it (LP: #379851)
  * debian/rules:
    - build with DH_PYCENTRAL=include-links LP: #342003
  * CommandNotFound/util.py:
    - use try gettext if lgettext fails (LP: #282446)
  * debian/copyright:
    - fix location (LP: #314478)
  * CommandNotFound/CommandNotFound.py:
    - be more robust about missing priority.txt (LP: #359784)
    - add simple spelling correction (LP: #314486)
  * debian/control:
    - build for all python versions (LP: #366096)

 -- Michael Vogt <email address hidden> Fri, 26 Jun 2009 13:58:24 +0200

Changed in command-not-found (Ubuntu):
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.