[issue3177] Add shutil.open

Chris Rebert report at bugs.python.org
Mon Apr 23 19:53:02 CEST 2012


Chris Rebert <pybugs at rebertia.com> added the comment:

>> ENOSYS was the closest approximation I could find. Thoughts? Custom
>> error class? Different errno? Something else?
>
> Why not ValueError?

Because the value they provided was perfectly valid (the file/directory *did* exist), so the caller's request was reasonable. It's the system(/ its (lack of) configuration) that failed the caller in finding an opener application. The "fix" after encountering the exception is to add an association to the system configuration (and/or install a new application), not to pass a different path to the function.

IMO, it feels like an EnvironmentError or RuntimeError of some sort; hence the current use of OSError.
(Or NotImplementedError, but we're already using that exception to indicate a different failure condition, so that's out.)

----------

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


More information about the Python-bugs-list mailing list