[Python-Dev] OSError.errno => exception hierarchy? (original) (raw)

Gustavo Carneiro gjcarneiro at gmail.com
Thu Apr 2 14:25:54 CEST 2009


Apologies if this has already been discussed.

I was expecting that by now, python 3.0, the following code:

        # clean the target dir
        import errno
        try:
            shutil.rmtree(trace_output_path)
        except OSError, ex:
            if ex.errno not in [errno.ENOENT]:
                raise

Would have become something simpler, like this:

        # clean the target dir
        try:
            shutil.rmtree(trace_output_path)
        except OSErrorNoEntry:       # or maybe os.ErrorNoEntry
            pass

Apparently no one has bothered yet to turn OSError + errno into a hierarchy of OSError subclasses, as it should. What's the problem, no will to do it, or no manpower?

Regards,

-- Gustavo J. A. M. Carneiro INESC Porto, Telecommunications and Multimedia Unit "The universe is always one step beyond logic." -- Frank Herbert -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20090402/5bd049a9/attachment.htm>



More information about the Python-Dev mailing list