Granularity of OSError
python at mrabarnett.plus.com
Sun Sep 20 03:22:21 CEST 2009
> In <mailman.107.1253369463.2807.python-list at python.org> MRAB <python at mrabarnett.plus.com> writes:
>> If, for example, you're
>> going to copy a file, it's a good idea to check beforehand that there's
>> enough space available for the copy.
> How do you do that?
There's os.statvfs(...), although that's Unix only.
The point is that it's sometimes a good idea to do a cheap check first
before attempting an operation that's 'expensive' even when it fails.
More information about the Python-list