subprocess - Execute files in windows with Python -
this question has answer here:
- open document default application in python 13 answers
i want make python program execute file in windows. means if try execute .txt
file, open default .txt
viewer. possible?
i tried subprocess.call
, windowserror: [error 193] %1 not valid win32 application
. file i'm trying run .png
file.
os.startfile("mytext.txt") #open text editor os.startfile("mytext.pdf") #open in pdf viewer os.startfile("mytext.html") #open in webbrowser
is how should
however
os.startfile("my_prog.py")
is bad idea because there no way know if python set default open *.py or if texteditor or ide set default open *.py
Comments
Post a Comment