For Linux this would give me /, for Windows on the C drive that would give me C:\. Note that python is not necessarily installed on the C drive on windows. Answer You can get the path to the Python executable using sys.executable: Then, for Windows, the drive letter will be the first part of splitdrive:
Tag: cross-platform
Is there a cross-platform way to open a file browser in Python?
I’m thinking something along the lines of the webbrowser module, but for file browsers. In Windows I’d like to open explorer, in GNOME on Linux I want to open nautilus, Konqueror on KDE, etc. I’d prefer not to kludge it up if I can avoid it. ;-) Answer I’d prefer not to kludge it up if I can avoid it.
How do you run a Python script as a service in Windows?
I am sketching the architecture for a set of programs that share various interrelated objects stored in a database. I want one of the programs to act as a service which provides a higher level interface for operations on these objects, and the other programs to access the objects through that service. I am currently aiming for Python and the