Does not handle KeyboardInterrupt

Bug #920300 reported by Vadim Peretokin
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
command-not-found
Won't Fix
Undecided
Unassigned
command-not-found (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I get:

File "/usr/lib/python2.7/site.py", line 562, in <module>
    main()
  File "/usr/lib/python2.7/site.py", line 545, in main
    known_paths = addsitepackages(known_paths)
  File "/usr/lib/python2.7/site.py", line 327, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/usr/lib/python2.7/site.py", line 195, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/usr/lib/python2.7/site.py", line 148, in addpackage
    f = open(fullname, "rU")
KeyboardInterrupt

Whenever I press ctrl+c to stop it from running, using 0.2.44.1ubuntu1. It shouldn't be erroring out when I wish to cancel it.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: command-not-found 0.2.44.1ubuntu1
ProcVersionSignature: Ubuntu 3.0.0-15.25-generic 3.0.13
Uname: Linux 3.0.0-15-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 1.23-0ubuntu4
Architecture: amd64
CheckboxSubmission: 65532cf2dcc18adf59d8dfa735190aed
CheckboxSystem: 3e53d3ea5811723345f19eff5070f9ab
Date: Mon Jan 23 15:13:17 2012
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Beta amd64 (20110413)
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=en_CA:en
 PATH=(custom, user)
 LANG=en_CA.UTF-8
 SHELL=/bin/bash
SourcePackage: command-not-found
UpgradeStatus: Upgraded to oneiric on 2011-10-19 (95 days ago)

Revision history for this message
Vadim Peretokin (vperetokin) wrote :
Changed in command-not-found (Ubuntu):
status: New → Confirmed
Changed in command-not-found:
status: New → Confirmed
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This is a bug in python that cannot be fixed in command not found. The error you are seeing happens before the application starts up. This is actually python runtime startup being interrupted

Changed in command-not-found (Ubuntu):
status: Confirmed → Invalid
Changed in command-not-found:
status: Confirmed → Won't Fix
Revision history for this message
Vadim Rutkovsky (roignac) wrote :

Can't we just handle it and show pretty 'Cancelled' output? See http://effbot.org/zone/stupid-exceptions-keyboardinterrupt.htm for example

Revision history for this message
Zygmunt Krynicki (zyga) wrote : Re: [Bug 920300] Re: Does not handle KeyboardInterrupt

On 01/31/2012 09:29 AM, Vadim Rutkovsky wrote:
> Can't we just handle it and show pretty 'Cancelled' output? See
> http://effbot.org/zone/stupid-exceptions-keyboardinterrupt.htm for
> example
>

Please re-read my previous comment. Unless you patch python there is
nothing an application can do to prevent this. We _do_ handle
KeyboardInterrupt exceptions by the way, just that most people don't get
to see that one as it simply silently quits.

Revision history for this message
Vadim Peretokin (vperetokin) wrote :

Perhaps the python interpreter could be wrapped around?

It's just... really unpleasant and unaesthetic.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Given the environment we are running in that is not feasible technically.
The correct solution is to either patch python or to write a C/vala client.

Last time I checked this (a few years ago) vala lacked bindings to gdbm, if that is changed we could track this in a blueprint.

Revision history for this message
Vadim Peretokin (vperetokin) wrote :

There are bindings: https://github.com/apmasell/vapis/blob/master/gdbm.vapi

Though I'm not for advocating a complete re-write just because of this...
unless someone has free time they'd like to spend on this.

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.