Reputation: 3104
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
also opens a command prompt, is there another way that won't open command prompt?
Upvotes: 29
Views: 129972
Reputation: 788
Try:
import subprocess
subprocess.Popen([file],shell=True)
Upvotes: 33
Reputation: 688
import webbrowser
webbrowser.open_new(r'file://C:\path\to\file.pdf')
Upvotes: 26