KeyboardInterrupt and threading

Jeff Epler jepler at unpythonic.net
Wed Jan 7 04:48:28 CET 2004


Running your attached program, it works just fine whereever I try it,
except on a system so old it only has Python 1.5 installed.  Even that
worked after a few seconds of editing.

Here's the behavior I saw on Fedora Core 1:
$ python ivan.py
CPU hog subthread spawned
main thread caught KeyboardInterrupt
CPU hog subthread joined at counter 76429

This is the behavior I saw on redhat 9:
$ python /tmp/ivan.py 
CPU hog subthread spawned
main thread caught KeyboardInterrupt
CPU hog subthread joined at counter 89897

Here's the behavior I saw on Red Hat 7.2:
CPU hog subthread spawned
main thread caught KeyboardInterrupt
CPU hog subthread joined at counter 31764

Here's the behavior I saw on Windows XP:
C:\...> python ivan.py
CPU hog subthread spawned
main thread caught KeyboardInterrupt
CPU hog subthread joined at counter 665928

Here's the behavior I saw on Red Hat 6.2:
$ python1.5 ivan.py 
  File "ivan.py", line 19
    self.counter += 1
                  ^
SyntaxError: invalid syntax
$ vi ivan.py
$ python1.5 ivan.py
CPU hog subthread spawned
main thread caught KeyboardInterrupt
CPU hog subthread joined at counter 238983

Jeff




More information about the Python-list mailing list