[issue3177] Add shutil.open

2018-03-02 Thread Socob
Change by Socob <206a8...@opayq.com>: -- nosy: +Socob ___ Python tracker ___ ___ Python-bugs-list mailing

[issue3177] Add shutil.open

2018-02-03 Thread amirjn
amirjn added the comment: same problem here -- ___ Python tracker ___ ___

[issue3177] Add shutil.open

2018-02-03 Thread amirjn
amirjn added the comment: same problem here -- nosy: +amirjn ___ Python tracker ___

[issue3177] Add shutil.open

2018-01-26 Thread Matej Cepl
Change by Matej Cepl : -- nosy: +mcepl ___ Python tracker ___ ___ Python-bugs-list mailing

[issue3177] Add shutil.open

2018-01-17 Thread Daniel Plakhotich
Daniel Plakhotich added the comment: > tl;dr: shutil.whatever should call startfile(..., 'edit') or xdg-open; other > actions implemented by startfile are not cross-platform. xdg-open is just a shell script that calls desktop-specific launchers. The behavior of

[issue3177] Add shutil.open

2012-07-31 Thread Ronald Oussoren
Ronald Oussoren added the comment: MacOSX provides functionality simular to os.startfile in the LaunchServices framework. I've tried to prototype a startfile implementation using this framework, (see issue3177-os_startfile_macosx.txt) but I'm not too happy about it because the APIs don't

[issue3177] Add shutil.open

2012-05-29 Thread Hobs
Hobs hobsonl...@gmail.com added the comment: shutil.whatever with os.startfile(..., 'edit'). That's why I thought an 'auto' option might be useful--to allow the caller to indicate that they want to respect the OS settings for open/run, if possible. --

[issue3177] Add shutil.open

2012-05-28 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: The latest discussion on this thread does not match my UNIX user model. tl;dr: shutil.whatever should call startfile(..., 'edit') or xdg-open; other actions implemented by startfile are not cross-platform. Well, so how about on UNIX

[issue3177] Add shutil.open

2012-05-28 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Note that my suggestion has an inconvenient on Windows. Take the example of HTML files; on an UNIX system I would decide whether I want them to be opened with my text editor or my web browser; I’d choose web browser because I launch my text

[issue3177] Add shutil.open

2012-05-28 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: (A last, very minor thing: please trim or remove quoted text when replying with the email interface (or on mailing lists); it puts unneeded wall of texts that reader waste time scanning, in case there were inline replies. Thanks in advance.)

[issue3177] Add shutil.open

2012-05-28 Thread Hobs
Hobs hobsonl...@gmail.com added the comment: Then they or we can add Konqueror, etc to the options that are 'try'ed for the 'view' option. Worst case they get a terminal cat of the file instead of an error message or unintended action (like running a script). What exactly are you proposing to do

[issue3177] Add shutil.open

2012-05-26 Thread Hobs
Hobs hobsonl...@gmail.com 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.

[issue3177] Add shutil.open

2012-05-26 Thread Larry Hastings
Larry Hastings la...@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

[issue3177] Add shutil.open

2012-05-25 Thread Larry Hastings
Larry Hastings la...@hastings.org added the comment: As an example, ``os.startfile(a.py)`` will usually run `a.py` in the Python interpreter, while ``xdg-open a.py`` it will usually open the source code in an editor on Linux. Well, so how about on UNIX shutil.launch (or whatever it's called)

[issue3177] Add shutil.open

2012-05-25 Thread Hobs
Hobs hobsonl...@gmail.com added the comment: Could even add an `operation` parameter to let the caller select actions, including 'auto' implemented as Larry suggests. Sometimes you feel like trusting the user's xdg-open preferences/settings. Sometimes you don't. Easy enough to let the caller

[issue3177] Add shutil.open

2012-05-25 Thread Larry Hastings
Larry Hastings la...@hastings.org added the comment: Could even add an `operation` parameter to let the caller select actions, [...] operation in ['auto', 'run', 'edit', 'display', 'browse', 'explore', 'share', 'send', 'like', 'email', 'open', 'xdg-open', ...] # can be incrementally

[issue3177] Add shutil.open

2012-04-27 Thread Miki Tebeka
Miki Tebeka miki.teb...@gmail.com added the comment: Just to note there's http://pypi.python.org/pypi/desktop/0.4 out there. -- nosy: +tebeka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3177

[issue3177] Add shutil.open

2012-04-27 Thread Hobs
Hobs hobsonl...@gmail.com added the comment: Had no idea. Sounds like a good place for it. On Apr 28, 2012 6:54 AM, Miki Tebeka rep...@bugs.python.org wrote: Miki Tebeka miki.teb...@gmail.com added the comment: Just to note there's http://pypi.python.org/pypi/desktop/0.4 out there.

[issue3177] Add shutil.open

2012-04-24 Thread Hobs
Hobs hobsonl...@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

[issue3177] Add shutil.open

2012-04-23 Thread Chris Rebert
Chris Rebert pyb...@rebertia.com added the comment: Here's a quick stab at 2/3rds of an implementation, and some docs. -- Added file: http://bugs.python.org/file25310/shutil_open.py ___ Python tracker rep...@bugs.python.org

[issue3177] Add shutil.open

2012-04-23 Thread Hobs
Hobs hobsonl...@gmail.com added the comment: Test passes on Ubuntu Oneiric Linux and 'open' action appropriately defaults to launching an editor for my particular OS settings. Tests on Windows in work. -- Added file: http://bugs.python.org/file25311/shutil_launch.py

[issue3177] Add shutil.open

2012-04-23 Thread Hobs
Hobs hobsonl...@gmail.com added the comment: Implement shutil.launch() fix minor shutil.disk_usage() doctext typo Name changed from shutil.open to shutil.launch due to namespace conflict with open() builtin within the shutil module and for users that do from shutil import * On Ubuntu

[issue3177] Add shutil.open

2012-04-23 Thread Chris Rebert
Chris Rebert pyb...@rebertia.com added the comment: # or os.name == 'mac' ??? Nope, that refers to retro Mac OS 9 (and probably lower). Mac OS X is 'posix' for os.name purposes. -- ___ Python tracker rep...@bugs.python.org

[issue3177] Add shutil.open

2012-04-23 Thread Chris Rebert
Chris Rebert pyb...@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

[issue3177] Add shutil.open

2012-04-23 Thread Ram Rachum
Changes by Ram Rachum r...@rachum.com: -- nosy: -cool-RR ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3177 ___ ___ Python-bugs-list mailing list

[issue3177] Add shutil.open

2012-04-23 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3177 ___ ___

[issue3177] Add shutil.open

2012-04-23 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Is the error raising PEP 3151 compliant? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3177 ___

[issue3177] Add shutil.open

2012-04-23 Thread Chris Rebert
Chris Rebert pyb...@rebertia.com added the comment: No, it isn't. Changing the `IOError(errno.ENOENT, ...`s to `FileNotFoundError(...`s would half fix it. The other half, the `OSError(errno.ENOSYS)`s, has a FIXME for what's the right error to raise in that case (no application associated with

[issue3177] Add shutil.open

2012-04-23 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: ENOSYS was the closest approximation I could find. Thoughts? Custom error class? Different errno? Something else? Why not ValueError? -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org

[issue3177] Add shutil.open

2012-04-23 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Thanks for relaunching this! I'm not sure I understand why this was moved to shutil.open. It seems appropriate to try to accomplish what os.startfile() does in a cross-platform way. Don't many of the other os.* calls do this--check os.name

[issue3177] Add shutil.open

2012-04-23 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Launch is far better than open for this, I think. If someone can come up with an even better name, that would be good. But I would not like to use open for this function, because it does not behave like other open functions. The one

[issue3177] Add shutil.open

2012-04-23 Thread Hobs
Hobs hobsonl...@gmail.com added the comment: Does no one like os.startfile as a home for this? Besides myself and the original 2008 proposer, of course. Can anyone explain to us newbies why it's a bad idea to have the cross-platform module do things identically across platforms? @David,

[issue3177] Add shutil.open

2012-04-23 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Please trust us that this is our policy. os is a thin wrapper only. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3177 ___

[issue3177] Add shutil.open

2012-04-23 Thread Hobs
Hobs hobsonl...@gmail.com added the comment: @Éric Thanks for clearing up my misunderstanding of os and shutil. I get it now. I'm sure you know this, and it's clear you agree with changing the name, but just to add fire to your resolve, the difference between shutil.open() and the other

[issue3177] Add shutil.open

2012-04-23 Thread Hobs
Hobs hobsonl...@gmail.com added the comment: New patch incorporates improvements from pitrou, cvrebert, r.david.murray, eric.araujo, cool-RR -- Added file: http://bugs.python.org/file25315/shutil_open.patch ___ Python tracker rep...@bugs.python.org

[issue3177] Add shutil.open

2012-04-23 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Initially this issue was about implementing a startfile-equivalent on posix. But if you have to add a gui option to startfile to not lanuch a GUI, and your real goal is a consistent way to launch non-gui programs on posix, then I don't

[issue3177] Add shutil.open

2012-04-23 Thread Sven Marnach
Sven Marnach s...@marnach.net added the comment: The semantics of associated application change considerably from operating system to operating system. As an example, ``os.startfile(a.py)`` will usually run `a.py` in the Python interpreter, while ``xdg-open a.py`` it will usually open the

[issue3177] Add shutil.open

2012-04-23 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: The semantics of associated application change considerably from operating system to operating system. As an example, ``os.startfile(a.py)`` will usually run `a.py` in the Python interpreter, while ``xdg-open a.py`` it will usually open the

[issue3177] Add shutil.open

2012-04-23 Thread Hobs
Hobs hobsonl...@gmail.com added the comment: Last patch was invalid and untested. New patch passes `make patchtest`, but still doing the full test suite on Windows and Linux. Still unsure if I raised the right exceptions with the right arguments. -- Added file:

[issue3177] Add shutil.open

2012-04-23 Thread Hobs
Hobs hobsonl...@gmail.com added the comment: I'll be happy to code, test, and use the new .() function wherever it ends up and whatever it is named... but... Initially this issue was about implementing a startfile-equivalent on posix. But if you have to add a gui option to startfile

[issue3177] Add shutil.open

2012-04-23 Thread Chris Rebert
Chris Rebert pyb...@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

[issue3177] Add shutil.open

2012-04-23 Thread Chris Rebert
Chris Rebert pyb...@rebertia.com added the comment: Hobs, why is exit code 4 of xdg-open (which the manpage describes as the extremely generic The action failed.) interpreted as FileNotFoundError in your new version? -- ___ Python tracker

[issue3177] Add shutil.open

2012-04-23 Thread Hobs
Hobs hobsonl...@gmail.com added the comment: Because that's how I caused the exception in Ubuntu--shutil.launch('file_that_doesnt_exist'). That's why I changed the message to file may not exist for both 2 and 4, but should probably prove that 2 sometimes happens when the file does exist (like

[issue3177] Add shutil.open

2012-04-23 Thread Chris Rebert
Chris Rebert pyb...@rebertia.com added the comment: Also: The FileNotFoundErrors quote the path twice: Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) path = /foo/bar print Path '%s' may not exist % repr(path) Path ''/foo/bar'' may not exist The ValueError error message

[issue3177] Add shutil.open

2012-04-23 Thread Chris Rebert
Chris Rebert pyb...@rebertia.com added the comment: The xdg-open source code (http://cgit.freedesktop.org/xdg/xdg-utils/tree/scripts/xdg-open ) shows that exit code 4 is used whenever an invocation of another opener script (e.g. kde-open, gnome-open) fails for any reason besides said script

[issue3177] Add shutil.open

2012-04-23 Thread Hobs
Hobs hobsonl...@gmail.com added the comment: Yea, I hosed up the path quoting in a misguided attempt at shortening for 80-col line-wrapping. Yours is better, will revert. On Tue, Apr 24, 2012 at 2:09 AM, Chris Rebert rep...@bugs.python.orgwrote: Chris Rebert pyb...@rebertia.com added the

[issue3177] Add shutil.open

2012-04-23 Thread Chris Rebert
Chris Rebert pyb...@rebertia.com added the comment: The semantics of associated application change considerably from operating system to operating system. As an example, ``os.startfile(a.py)`` will usually run `a.py` in the Python interpreter, while ``xdg-open a.py`` it will usually open

[issue3177] Add shutil.open

2012-04-23 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: I'm not a lawyer (duh), but my understanding is that *looking* at GPL code (as opposed to proprietary code, where someone might sue you about it and not looking is a good defense) is OK, you just can't copy it. --

[issue3177] Add shutil.open

2012-04-23 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I'm not a lawyer (duh), but my understanding is that *looking* at GPL code (as opposed to proprietary code, where someone might sue you about it and not looking is a good defense) is OK, you just can't copy it. You could probably copy a one-

[issue3177] Add shutil.open

2012-04-23 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: -haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3177 ___ ___ Python-bugs-list

[issue3177] Add shutil.open

2012-04-23 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: Added file: http://bugs.python.org/file25332/shutil_open.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3177 ___

[issue3177] Add shutil.open

2012-04-22 Thread Hobs
Hobs hobsonl...@gmail.com added the comment: @eric.araujo, @giampaolo.rodola, (http://bugs.python.org/issue3177#msg140275) I'm not sure I understand why this was moved to shutil.open. It seems appropriate to try to accomplish what os.startfile() does in a cross-platform way. Don't many of

[issue3177] Add shutil.open

2012-04-01 Thread Chris Rebert
Chris Rebert pyb...@rebertia.com added the comment: (2) Target file doesn't exist (4) No application is associated with the file type in question I think that instead of mapping error codes to custom exceptions, which is fragile and not trivial to maintain, we should just catch stderr and

[issue3177] Add shutil.open

2012-03-31 Thread Chris Rebert
Chris Rebert pyb...@rebertia.com added the comment: The alternative is to call Popen(['xdg-open', etc.]) and check if we get ENOENT, but I don’t know if this would be non-ambiguous (for example, do we get ENOENT if xdg-open exists but not the file?). It's unambiguous. Python itself never

[issue3177] Add shutil.open

2012-03-31 Thread STINNER Victor
STINNER Victor victor.stin...@gmail.com added the comment: (1) Platform doesn't support this feature - raise NotImplemented It's better to not define the function if the platform doesn't support the feature. -- ___ Python tracker

[issue3177] Add shutil.open

2012-03-31 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: [...] do we get ENOENT if xdg-open exists but not the file?). It's unambiguous. Python itself never opens the target file, it just passes the filepath string along to the xdg-open command. If Popen raises EnvironmentError, then xdg-open

[issue3177] Add shutil.open

2012-03-31 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3177 ___

[issue3177] Add shutil.open

2011-07-30 Thread Roman Evstifeev
Changes by Roman Evstifeev someuniquen...@gmail.com: -- nosy: +Roman.Evstifeev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3177 ___ ___

[issue3177] Add shutil.open

2011-07-15 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: as long as it's implemented and it's in the standard library, and people don't have to use subprocess to run open or xdg-open themselves as I currently do. This new function would call os.startfile on Windows, xdg-open where applicable, and

[issue3177] Add shutil.open

2011-07-15 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: dependencies: + Finding programs in PATH, adding shutil.which Why did you add this dependency? For example, subprocess is able to locate a program if the program has no full path. We don't need a which function. -- nosy:

[issue3177] Add shutil.open

2011-07-15 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: See also lengthy discussion on #1301512. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3177 ___

[issue3177] Add shutil.open

2011-07-15 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: dependencies: + Finding programs in PATH, adding shutil.which Why did you add this dependency? For example, subprocess is able to locate a program if the program has no full path. We don't need a which function. While the Windows API call is