News for hackers. Stuff that matters.
Re:Python 1.0.0 is out (1994) by eesmith on Saturday January 27, 2018 @07:50AM (#16246023)
While it's never been a problem for me, I can see that #1 makes a lot of sense.

  % python -c pass
  ^CTraceback (most recent call last):
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 62, in <module>
      import os
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 400, in <module>
    import UserDict
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py", line 83, in <module>
      import _abcoll
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_abcoll.py", line 9, in <module>
      """
  KeyboardInterrupt
There was some discussion about this at https://bugs.python.org/issue14228 , with strong pushback from some of the core developers.

One of the workarounds was to do:

  python -S
to avoid importing the site module, then set your signal handlers, then import site manually. In that case the only output, if caught at the wrong time, will be the message 'KeyboardInterrupt'. This isn't quite what you want, but it's a lot closer.

(Another request for this feature is at https://bugs.python.org/issue24261 .)

If you are still working with Python, and still want this feature, you might contribute to that second thread. The first is rather contentious.

There are no comments on this comment yet.