|
From: Gibhardt, H. <hg...@gw...> - 2011-11-21 11:46:20
|
Dear Michael, >Ouch, not good. But if the attempt to write raises an exception, that can be caught with try / except, why does that >exception not stop execution? If the code blocks then it can't raise an exception. If it raises an exception then it isn't >blocked. now I understand your point and see, that I explained the crash not exactly: There is an exception, which comes from the python function "open". But, as I did not catch this exception, my program hung up. >This seems like good code for your particular situation, but I don't think it's generally necessary. (The exception >handling masks the original error for example by reraising the exception as a GammaError.) O.k., using my defined "GammaError" is the way, we get a possible error to the user (giving him an information about a missing .ini-file). I think, this is a problem, which should be handled in configobj.py: You check at the beginning, if the filehandler yields a good result (what I called "safe"). But later, this is not done anymore: The file could be blocked by another application, could be deleted whatsoever. Then you have the "open" exception and you must find out, what was responsible for this exception. File opening should be handled safe at any time like in standard C. If you don't agree to my opinion, it's no problem. Best regards Holger |