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)
        self.viewurlbttn.grid(row=2,column=1,columnspan=3)

    def urlopen(self):
        import webbrowser
        webbrowser.open(Interface.url)

p.s. I'm using tkinter

Edited 5 Years Ago by pyguy62: n/a

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

Edited 5 Years Ago 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>
    webbrowser.get('mozilla')
  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 5 Years Ago by snippsat: n/a

This question has already been answered. Start a new discussion instead.