[New-bugs-announce] [issue22678] An OSError subclass for "no space left on device" would be nice

Mathieu Bridon report at bugs.python.org
Mon Oct 20 18:27:15 CEST 2014


New submission from Mathieu Bridon:

I found myself writing the following code the other day:

        try:
            os.mkdir(path)
            
        except PermissionError:
            do_something()

        except FileExistsError:
            do_something_else()

        except FileNotFoundError:
            do_yet_another_thing()

        except OSError as e:
            import errno
            if e.errno == errno.ENOSPC:
                and_do_one_more_different_thing()

            else:
                raise e

The OSError subclasses in Python 3 are amazing, I love them.

I just wish there'd be more of them. :)

----------
components: Library (Lib)
messages: 229729
nosy: bochecha
priority: normal
severity: normal
status: open
title: An OSError subclass for "no space left on device" would be nice
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22678>
_______________________________________


More information about the New-bugs-announce mailing list