When I try on Windows
webbrowser.open(fname)
or os.startfile(fname)
or os.system ('cmd /c "start %s"' % fname)
my python script is getting executed.
How to open it for edit in default editor (like SQL script)
Edit:
import ctypes
shell32 = ctypes.windll.shell32
fname = r'C:\Scripts\delete_records.py'
shell32.ShellExecuteA(0,"open",fname,0,0,5)
it opens file explorer at C:\Program Files\ibm\gsk8\lib64\C