[Python-Dev] POSIX [Fuzziness in io module specs] (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Sun Sep 20 02:23:20 CEST 2009
- Previous message: [Python-Dev] POSIX [Fuzziness in io module specs]
- Next message: [Python-Dev] POSIX [Fuzziness in io module specs]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Nick Coghlan wrote:
For example, a file not existing, a file being locked by another process, and the user not having write permissions to the file are problems that demand very different responses from the user.
You can display an error-specific message without having to inspect the error code, e.g.
try: something_with_file(path) except EnvironmentError, e: report_error("Couldn't do that with %s: %s" % (path, e))
This is a pattern I use a lot, and it seems to work pretty well.
-- Greg
- Previous message: [Python-Dev] POSIX [Fuzziness in io module specs]
- Next message: [Python-Dev] POSIX [Fuzziness in io module specs]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]