On 25.12.12 23:55, Andrew Svetlov wrote:
Currently we have exception tree of classes inherited from OSError
When we use C API we can call PyErr_SetFromErrno and
PyErr_SetFromErrnoWithFilename[Object] functions.
This ones raise concrete exception class (FileNotFoundError for
example) looking on implicit errno value.
I cannot see the way to do it from python.

>>> raise OSError(errno.ENOENT, 'No such file or directory', 'qwerty')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'qwerty'


_______________________________________________
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