Catching a specific IO error
Tina I
tinaweb at bestemselv.com
Wed Apr 25 03:01:39 EDT 2007
Gabriel Genellina wrote:
> You can get the 2 as the errno exception attribute. BTW, 2 == errno.ENOENT
>
> try:
> export = open(self.exportFileName , 'w')
> except IOError, e:
> if e.errno==errno.ENOENT:
> # handle the "No such file or directory" error
> # calling an error handling method.
>
> See http://docs.python.org/lib/module-exceptions.html
>
> --Gabriel Genellina
Perfect! Just what I was looking for. Thank you! :)
Tina
More information about the Python-list
mailing list