I'm new to coding in python and I'm wondering if some one can explain why this code works on the second try but not on the first?
I was just trying to open a browser that was not the default one.
first try --> did not work
import webbrowser
url='https://www.mozilla.org'
webbrowser.register('firefox', None)
webbrowser.BackgroundBrowser("C:\\Program Files\\Mozilla Firefox\\firefox.exe")
webbrowser.get('firefox').open(url)
webbrowser.Error: could not locate runnable browser
Process finished with exit code 1
second try --> works
import webbrowser
url='https://www.mozilla.org'
webbrowser.register('firefox', None, webbrowser.BackgroundBrowser("C:\\Program Files\\Mozilla Firefox\\firefox.exe"))
webbrowser.get('firefox').open(url)
Process finished with exit code 0