I have attempted to reproduce my problem described below under only Python 2.7.3.
The most reliable way that I found to elicit my problem in the question is to pipe my output of the next test script through the use of : (under bash):
for m in range(40):
The error message received as below :
% mypython testscript.py | :
close failed in file object destructor:
sys.excepthook is missing
As the test script clearly shows that the error cannot be trapped with the try-except.
My question is as below:
How can I modify my test script above to avoid facing the error message whenmy script is run as shown above (under the Unix/bash)?