Opening a folder in Explorer/Nautilus/Mac-thingie

Hello, I have the path of a certain folder. I want to open it using the default folder explorer for that system. For example, if it's a Windows computer, I want to use Explorer, if it's Linux, I want to use Nautilus or whatever is the default there, if it's Mac, I want to use whatever Mac OS's explorer is called. I asked this on StackOverflow: http://stackoverflow.com/questions/6631299/python-opening-a-folder-in-explor... But it seems that Python doesn't offer a cross-platform way to do this. I see this functionality as pretty similar to that of the `webbrowser` module. Do you think that this is something that could be included with the standard library? Ram.

On Sat, Jul 9, 2011 at 2:35 AM, cool-RR <cool-rr@cool-rr.com> wrote:
Invoking the appropriate platform-specific open-with-default-program command with a folder argument should work: http://stackoverflow.com/questions/434597/open-document-with-default-applica... If anything should be added to the std lib, I would say it should be this rather than a more narrow open-with-platform's-file-manager function. Cheers, Chris

On Sat, Jul 9, 2011 at 6:02 AM, Chris Rebert <pyideas@rebertia.com> wrote:
I agree, it's better to introduce an open-with-default-program function. It seems that `os.startfile` is supposed to do this: http://docs.python.org/dev/library/os.html#os.startfile But it's only available under Windows. Perhaps the solution is to implement it under Linux and Mac as well, so we don't need to introduce a new function? Ram.

Opened a ticket for this: http://bugs.python.org/issue12522?@ok_message=msg%20140057%20created%3Cbr%3Eissue%2012522%20created&@template=item Ram.

On Sat, Jul 9, 2011 at 2:35 AM, cool-RR <cool-rr@cool-rr.com> wrote:
Invoking the appropriate platform-specific open-with-default-program command with a folder argument should work: http://stackoverflow.com/questions/434597/open-document-with-default-applica... If anything should be added to the std lib, I would say it should be this rather than a more narrow open-with-platform's-file-manager function. Cheers, Chris

On Sat, Jul 9, 2011 at 6:02 AM, Chris Rebert <pyideas@rebertia.com> wrote:
I agree, it's better to introduce an open-with-default-program function. It seems that `os.startfile` is supposed to do this: http://docs.python.org/dev/library/os.html#os.startfile But it's only available under Windows. Perhaps the solution is to implement it under Linux and Mac as well, so we don't need to introduce a new function? Ram.

Opened a ticket for this: http://bugs.python.org/issue12522?@ok_message=msg%20140057%20created%3Cbr%3Eissue%2012522%20created&@template=item Ram.
participants (3)
-
Chris Rebert
-
cool-RR
-
cool-RR