[issue3177] Add shutil.open

Larry Hastings report at bugs.python.org
Sun May 27 01:00:16 CEST 2012


Larry Hastings <larry at hastings.org> added the comment:

> In Linux we could `try` nautilus then Mozilla
> (file://.../containing_folder) then fall back to a shell
> `cd && ls` if no browser is available, raising NotImplemented
> if all else fails... until someone implements for that
> user's platform particulars.

What if they're using a KDE-based system?  Or XFCE?  Or xmonad?  Or qtile?
What if their preferred file browser is Midnight Commander?
What if they use Chrome?  Or Konqueror?  Or Opera?  Or Lynx?

Designing a cross-platform API based on abilities provided by only one of those platforms, then waiving your hand and saying "I'm sure the other platforms will add this functionality sometime", is poor cross-platform API design.  OS X is 11 years old, GNOME is 13, KDE is 16, and none of the above appear to be in a hurry to add this feature.  And even on Windows, which has had this feature for 17 years (IIRC it was introduced with Windows 95)... it is hardly ever used.  99.999% of the time you simply want to "open" the file using the user's preferred app.

Since Windows users already have an API to access this extra functionality on their platform (os.startfile) I assert that the cross-platform API should only expose the functionality that's available across platforms.  Hence my proposal for "execute".

----------

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


More information about the Python-bugs-list mailing list