Look at webbrowser module.
Source code
Unwillingly supported
Test:
This will not work as can not find file association for
webbrowser.open(filename)
it can call os.startfile(), open, xdg-open
where appropriate.Source code
Unwillingly supported
Quote:Note that on some platforms, trying to open a filename using this function,may work and start the operating system’s associated program.
However, this is neither supported nor portable.
Test:
import webbrowser webbrowser.open('Alarm.wav')
import os os.startfile('Alarm.wav')Both work the same and open program that file association with
.wav
in Windows. This will not work as can not find file association for
.wav
.import subprocess subprocess.run(['Alarm.wav'])Discussion about making
os.startfile
work cross platform,don't think they agree on something.