Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Standard way to open a folder window in linux?

I want to open a folder window, in the appropriate file manager, from within a cross-platform (windows/mac/linux) Python application.

On OSX, I can open a window in the finder with

os.system('open "%s"' % foldername)

and on Windows with

os.startfile(foldername)

What about unix/linux? Is there a standard way to do this or do I have to special case gnome/kde/etc and manually run the appropriate application (nautilus/konqueror/etc)?

This looks like something that could be specified by the freedesktop.org folks (a python module, similar to webbrowser, would also be nice!).

like image 651
dF. Avatar asked Sep 03 '08 15:09

dF.


1 Answers

os.system('xdg-open "%s"' % foldername)

xdg-open can be used for files/urls also

like image 149
pixelbeat Avatar answered Sep 20 '22 00:09

pixelbeat