(Jul-10-2018, 11:22 PM)metulburr Wrote: Im not too sure about windows but you may have to register it?
import webbrowser ffpath = 'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe' print(webbrowser._tryorder) webbrowser.register('firefox', None, webbrowser.BackgroundBrowser(ffpath), 1) print(webbrowser._tryorder) ff = webbrowser.get('firefox') ff.open("http://www.google.com")
this is what I get
Error:['windows-default', 'C:\\Program Files (x86)\\Internet Explorer\\IEXPLORE.EXE']
Traceback (most recent call last):
File "C:\Python36\kodovi\browsers.py", line 3, in <module>
wb.register('firefox', None, wb.BackgroundBrowser(ffpath), 1)
NameError: name 'ffpath' is not defined
I practise Python on old laptop that has Windows 7. What I did is that I made Firefox a default browser through itself - Tools > Options. It's a simplier option, but I wanted to know is it possible to change a browser through a code.