[issue3177] Add shutil.open

Hobs report at bugs.python.org
Tue Apr 24 09:14:06 CEST 2012


Hobs <hobsonlane at gmail.com> added the comment:

I can see why this partial implementation of `operation` in this ver seems
useless. But it is a placeholder for eventually providing Linux/Mac users
with the same functionality as windows. The os.startfile() or
shutil.launch() function can easily fill the gap left by the OS, which is
what os does for lots of other missing  OS features on one platform or
another.

I'll delete the OS9 ('mac') test comment and leave an implementation for
those platforms up to others?

`gui` is for software that intends to launch user's $EDITOR, vi, nano,
emacs, etc. This is intended to generalize startfile to encompass a common
pattern, e.g. in bzr, hg. Perhaps it doesn't belong in ver1 until we sort
out all the other uncomfortable things about this patch.

I'll test all the windows and linux exception possabilities and get back to
you on what exceptions startfile() normally raises, and whether this
implementation of shutil.launch() raises comparable exceptions.

Cheers,
H
On Apr 23, 2012 7:53 PM, "Chris Rebert" <report at bugs.python.org> wrote:

>
> Chris Rebert <pybugs at rebertia.com> added the comment:
>
> `operation` seems questionable. IMO, the verbs seem stronger / more
> important than mere optional suggestions (particularly "open" vs. "edit"
> for files with read-only viewers), and only Windows supports them (so
> anyone requiring that feature might as well just use startfile() directly).
> By virtue of this function being cross-platform, we're kinda limited to
> just supporting the lowest common denominator.
>
> Hobs, can you explain `gui`?
>
> Also, does startfile() raise exceptions for either of the basic error
> conditions ("no such file" and "no associated application")? If not, I
> believe using the lower-level ShellExecute (
> http://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx) or similar Windows API function would allow us to report such errors, as
> the other platform implementations currently do.
>
> ----------
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue3177>
> _______________________________________
>

----------

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


More information about the Python-bugs-list mailing list