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

Recommended Answers

All 7 Replies

also, I've tried


and got an error

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

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'') 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\", 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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.