Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28517

Re: how can i register the non-default browser with the webbrowser module?

From Peter Otten <__peter__@web.de>
Subject Re: how can i register the non-default browser with the webbrowser module?
Date 2012-09-05 18:09 +0200
Organization None
References <CAEMsKDsa6WDVzTPh3XNueNJ0dZza+gSthV3KcZ5CiLEiYRgmKw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.251.1346861389.27098.python-list@python.org> (permalink)

Show all headers | View raw


Levi Nie wrote:

> how can i register the non-default browser with the webbrowser module?
> 
> the case:
> i want open a site such as "google.com" in ie8 with the python.But my
> default is chrome.
> so i want to register a ie8 controller with the
> webbrowser.register(*name*, *constructor*[, *instance*]).
> so what does the parameter "constructor" "instance" mean?
> how can i do it?

Isn't there already a controller for ie8? I can't check, but you can list 
the available browsers with

>>> import webbrowser
>>> list(webbrowser._browsers)
['x-www-browser', 'kfmclient', 'firefox', 'konqueror']

Then if you want to open a page with a specific browser just do

url = "http://www.python.org"
browser = "firefox"
webbrowser.get(browser).open(url)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: how can i register the non-default browser with the webbrowser module? Peter Otten <__peter__@web.de> - 2012-09-05 18:09 +0200

csiph-web