Misleading IOerror when opening a non-existent file for append?

Fredrik Lundh fredrik at pythonware.com
Wed Nov 22 08:42:23 CET 2006


jkn wrote:

> This 'invalid mode: a' error message seems weird to me. Is this a bug
> or am I missimg something?

It depends on the underlying implementation of fopen(), which, on some 
platforms, doesn't set the right error code for bad mode strings. 
Python uses some simple heuristics to try to get around this (earlier 
versions could give "error: no error" for this case), but they're not 
always able to do the right thing.

</F>




More information about the Python-list mailing list