I want to open an image in the default browser with Python. I thought it might be as simple as
webbrowser.open(path_to_file), but on XP at least that opens the Windows Picture and Fax Viewer instead.
I want to open an image in the default browser with Python. I thought
Share
Well, it should be that simple (in my opinion), but the problem is with how the webbrowser module sets up the default browser on Windows. Because of this, when you type in
what is then called is
which works fine for url’s, but for files, it uses the Windows Picture and Fax Viewer unless you’ve associated some other program with the image file type. Basically, if you use the webbrowser.get() command to get an actual browser it will be fine. Here’s a way to do it with internet explorer on Windows (which has been set-up in the webbrowser module to be the hardest to get) :
other ones like firefox are easier to get: