[Python-ideas] Opening a folder in Explorer/Nautilus/Mac-thingie

Chris Rebert pyideas at rebertia.com
Sat Jul 9 12:02:30 CEST 2011


On Sat, Jul 9, 2011 at 2:35 AM, cool-RR <cool-rr at cool-rr.com> wrote:
> 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-explorer-nautilus-mac-thingie
> But it seems that Python doesn't offer a cross-platform way to do this.

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-application-in-python

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



More information about the Python-ideas mailing list