starting windows program from python based on file extension ?

K

kowald

Hi everybody,

I used python to build a HTML file and now I would like to
automatically start my browser to display this file. I guess I could
use os.system(), but then I had to specify a specific path to the
browser.

I wonder if it is possible to tell windows to open "myFile.html" using
the program that is registered to open html files (similar to double
clicking on the file).

Any idea how to do that from python ??

Many thanks,

Alex
 
F

F. Petitjean

Le 3 Mar 2005 02:53:51 -0800, (e-mail address removed) a écrit :
Hi everybody,

I used python to build a HTML file and now I would like to
automatically start my browser to display this file. I guess I could
use os.system(), but then I had to specify a specific path to the
browser.

I wonder if it is possible to tell windows to open "myFile.html" using
the program that is registered to open html files (similar to double
clicking on the file).

Any idea how to do that from python ??
import os
os.startfile("myFile.html")
# on windows only
 
D

Duncan Booth

wrote:
I wonder if it is possible to tell windows to open "myFile.html" using
the program that is registered to open html files (similar to double
clicking on the file).

Any idea how to do that from python ??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top