Public bug reported:
I'm a Python developer. After upgrading to Feisty, an ImportError seems
to have triggered a hook in /var/lib/python-
support/python2.4/apport_python_hook.py. This then calls into /var/lib
/python-support/python2.4/apport/report.py. This is a lot of code. I am
rather shocked to see that a simple uncaughed Python exception on Ubuntu
now has such a large side effect. Especially since this code actually
has a bug in it.
Write a Python script foo.py with the following content:
import doesntexist
Then do chmod +x on it. It appears this triggers your error handling
code, as this assumes the Python is an OS-installed executable. Then run
it using python2.4.
You'll get an error like this:
Traceback (most recent call last):
File "foo.py", line 1, in ?
import doesntexist
ImportError: No module named doesntexist
Error in sys.excepthook:
Traceback (most recent call last):
File "/var/lib/python-support/python2.4/apport_python_hook.py", line 54, in
apport_excepthook
pr.add_proc_info()
File "/var/lib/python-support/python2.4/apport/report.py", line 334, in
add_proc_info
self._check_interpreted()
File "/var/lib/python-support/python2.4/apport/report.py", line 244, in
_check_interpreted
if not any([fnmatch.fnmatch(exebasename, i) for i in interpreters]):
NameError: global name 'any' is not defined
Original exception was:
Traceback (most recent call last):
File "foo.py", line 1, in ?
import doesntexist
ImportError: No module named doesntexist
>From eyeballing the exception, it's likely that the apport code was
written with Python 2.5, which defines 'any', and that this behavior was
never tested against Python 2.4.
Having a such heavy-handed exception hook is pretty bad news for me. My
build tools (zc.buildout) generate Python scripts with the executable
flag set all the time, and now I have Ubuntu's error handling to worry
about, which isn't starting out by inspiring a lot of confidence. I can
see what you're trying to accomplish here, but perhaps there is a better
way? Only let the hook kick in for executable scripts that are installed
under /usr, perhaps?
Me, I will be compiling and installing my own Python 2.4 interpreter in
my user directory for the time being.
** Affects: Ubuntu
Importance: Undecided
Status: Unconfirmed
--
apport uses any() in python2.4
https://bugs.launchpad.net/bugs/109391
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs