Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
How do I open a file from python? Not using the open() function and read or write, I mean simulate a user double clicking on the file. So if I open file1.jpg I want it to open using the default image program.
Thanks
os.system(dxg-open)
in linux you can use xdg-open like bellow:
from subprocess import call call(['xdg-open','filename'])
On windows, you get this behavior if you execute through the win32 shell. An easy way to do that is with the subprocess module:
import subprocess as subp subp.call('file1.jpg', shell=True)
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
os.system(dxg-open)