Reputation:
I don't have any Mac OSx or Linux machine, but I want to implement the functionality like opening an explorer from a selected file path.
for example
import subprocess
subprocess.Popen('explorer "E://temp//"')
the above code opens windows explorer for a specified path, how to do it for Mac or Linux ?
Upvotes: 0
Views: 1737
Reputation: 126787
You can use the desktop package (in particular its open
function) to take care of the OS-specific details. It should work on Linux, Windows and OS X.
If you want to do this on your own, instead, you can:
xdg-open
on Linux;open
on OS X;os.startfile
on Windows.Upvotes: 1