After marking gofish up to a temporary loss I've moved back to my address book. The issue I'm currently having is that webbrowser is opening the wrong broswer. I've set my default browser to firefox (currently using windows vista), and yet the program is still opening IE, however when I tried webbrowser.open('whatever') it opened with firefox. Below is the relevant code, any ideas?

self.viewurlbttn= Button(self, text='Open URL', command=self.urlopen)

    def urlopen(self):
        import webbrowser

p.s. I'm using tkinter

Edited by pyguy62: n/a

5 Years
Discussion Span
Last Post by snippsat

Are you sure extension is same, you could for example have html registered for firefox and htm for ie?

Edited by pyTony: n/a


I'm pretty sure. I've also tried the path to firefox, which didn't work. This wouldn't be such an annoying issue if it didn't work in interactive mode either, but it does webbrowser.open('www.google.com') opens an instance of firefox, so why wouldn't it work in the program?


however trying the get() method in interactive mode also raises an error:

>>> webbrowser.get('mozilla')#same with 'firefox'
Traceback (most recent call last):
  File "<pyshell#12>", line 1, in <module>
  File "C:\Python32\lib\webbrowser.py", line 53, in get
    raise Error("could not locate runnable browser")
webbrowser.Error: could not locate runnable browser

Okay, now firefox is being used as the default browser for it, I don't know why there was a delay. But still nothing is working for webbrowser.get('whateverbrowser')


update: Firefox will only open if the parameters include www. or http:// otherwise it will open with IE...


But still nothing is working for webbrowser.get('whateverbrowser')

webbrowser.get('whateverbrowser') will search in environment variable path.
If it dont find path to firefox it will give back.
webbrowser.Error: could not locate runnable browser

So to environment variable path you have to add path to firefox.
;c:\...path to firefox for me it look like this ;C:\Programfiler\Mozilla Firefox\
Then restart and try again.

Edited by snippsat: n/a

This question has already been answered. Start a new discussion instead.
Be sure to adhere to our posting rules.