I wanna open pdf file from python console, I can do it with os.system(filename)
, it will open in adobe reader, but the problem is that os.system
al
import os
os.startfile(filename)
Try:
subprocess.Popen([file],shell=True)
This is a bit late but nobody mentioned:
open("file_name.pdf")
import webbrowser
webbrowser.open_new(r'file://C:\path\to\file.pdf')
Read the documentation thoroughly. The very first line of the os.system method is:
Execute the command (a string) in a subshell.
Knowing this, you can now seek alternate solutions, such as the subprocess module already mentioned.