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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to