starting windows program from python based on file extension ?

Discussion in 'Python' started by kowald@molgen.mpg.de, Mar 3, 2005.

  1. Guest

    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
    , Mar 3, 2005
    #1
    1. Advertising

  2. F. Petitjean Guest

    Le 3 Mar 2005 02:53:51 -0800, 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
    >
    > Many thanks,
    >
    > Alex
    >
    F. Petitjean, Mar 3, 2005
    #2
    1. Advertising

  3. Duncan Booth Guest

    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 ??


    >>> import webbrowser
    >>> webbrowser.open('test.html')
    Duncan Booth, Mar 3, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. BLF
    Replies:
    4
    Views:
    1,260
    Mike Treseler
    Aug 7, 2004
  2. Kristof Despiere
    Replies:
    4
    Views:
    433
    Kristof Despiere
    May 29, 2004
  3. dfaber
    Replies:
    1
    Views:
    351
    Amit Khemka
    Jul 4, 2006
  4. Steve
    Replies:
    3
    Views:
    26,926
    Steve
    Aug 25, 2006
  5. llothar
    Replies:
    17
    Views:
    1,232
    Steve Holden
    Apr 7, 2008
Loading...

Share This Page