The OS module on Windows or MacOS has the following;
os.system("start APPLICATION.EXTENSION filename")
Will open filename (I mean actually open rather than python open, as if you did Right mouse>open) if its in the same folder as the python file on windows. The MacOS version is;
os.system("open filename")
What I'm asking for is the linux equivalent. If you know of a different module or method I'm open to anything.
All I've been able to find online is the usual
file = filepath
open(file)
read(file)
And these are absolutely not what I want to achieve. Any and all help is much appreciated, you might be able to tell this issue is getting to me.
openwill launch the GUI or other app associated with the file extension or the file itself. So Python won't know anything about that. Furthermore, unless it has changed recently, the open semantics on Windows can be problematic. In a DOS batch file, if you start a text.txt while Notepad is open, the call returns right away to the batch. If Notepad was not open, and had to be started, the batch blocks at that line, until Notepad is closed.os.systemsimply runs a shell command using the default shell. Whether any particular Linux distribution has an equivalent of Windowsstartor macOSopenis independent of Python or any other programming language.