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

Re: Wrong webbrowser opening 80 80

also, I've tried

webbrowser.get('firefox')

and got an error

Re: Wrong webbrowser opening 80 80

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

Re: Wrong webbrowser opening 80 80

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?

Re: Wrong webbrowser opening 80 80

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
Re: Wrong webbrowser opening 80 80

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

Re: Wrong webbrowser opening 80 80

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

Re: Wrong webbrowser opening 80 80

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.