os.startfile is only available for windows for now, but xdg-open will be available on any unix client running X.
if sys.platform == 'linux2':
subprocess.call(["xdg-open", file])
else:
os.startfile(file)
More Related Contents:
- Getting MAC Address
- Python pysftp get_r from Linux works fine on Linux but not on Windows
- fcntl substitute on Windows
- Python: how to kill child process(es) when parent dies?
- Shebang Notation: Python Scripts on Windows and Linux?
- How to find the real user home directory using python?
- Packaging a Python script on Linux into a Windows executable
- Cross-platform subprocess with hidden window
- Python virtualenv questions
- Cross-platform space remaining on volume using python
- Can Python select what network adapter when opening a socket?
- How to use “/” (directory separator) in both Linux and Windows in Python?
- Python multiprocessing linux windows difference
- pip install fails with “connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)”
- PyWin32 and Python 3.8.0
- Python – Windows Shutdown Events
- Set up Python on Windows to not type “python” in cmd
- How do you set your pythonpath in an already-created virtualenv?
- Fastest way to take a screenshot with python on windows
- How do I run Python script using arguments in windows command line
- MSSQL2008 – Pyodbc – Previous SQL was not a query
- How to configure Python Kivy for PyCharm on Windows?
- System-wide mutex in Python on Linux
- How can I simulate input to stdin for pyunit?
- How can I add python to cmd in windows [closed]
- Installing pygraphviz on Windows 10 64-bit, Python 3.6
- multiprocessing pool example does not work and freeze the kernel
- multiprocessing: How can I ʀᴇʟɪᴀʙʟʏ redirect stdout from a child process?
- How to move .conda from one folder to another at the moment of creating the environment
- Python file.write creating extra carriage return