[Pythonmac-SIG] Wierd Error/Bug in MacPython 2.0

Jack Jansen jack@oratrix.nl
Fri, 08 Jun 2001 10:43:24 +0200


I'd say just rerun the whole computation that generates the output file. The 
problem may have occurred earlier than the close() but may only become visible 
at that point.

Look at MkDistr.py, it does something like
    try:
        copy(oldfile, newfile)
    except:
        try:
           i = 1 / 0
        except:
           pass
        copy(oldfile, newfile)

The second try/except is a trick to clear the stacktrace: it will still 
contain open file objects for the input and output file, and you want to get 
rid of them before trying again.

I wouldn't do a "while 1:" because there are many reasons the thing could 
fail. If it fails for the silly-close-bug reason once every 400 times this 
code will make it fail only once very 16000 times, so that should be good 
enough.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm