Open IE Browser Window

The webbrowser library provides a convenient way to launch a URL with a browser window through the method. Numerous browser types are available, but there does not appear to be an explicit way to launch Internet Explorer when running python on windows.

WindowsDefault only works if Internet Explorer is set as the default browser, which is not an assumption I can make.

Is there a way to explicitly launch a URL into Internet Explorer without reverting to windows API calls?


More elegant code:

import webbrowser

ie = webbrowser.get(webbrowser.iexplore)'')

>>> ie = webbrowser.get('c:\\program files\\internet explorer\\iexplore.exe')

iexplore = os.path.join(os.environ.get("PROGRAMFILES", "C:\\Program Files"),
    "Internet Explorer\\IEXPLORE.EXE")
ie = webbrowser.BackgroundBrowser(iexplore)

This is what the webrowser module uses internally.

You can always do something like

subprocess.Popen('"C:\\Program Files\\Internet Explorer\\iexplore.exe"')

The simplest way:

import subprocess
subprocess.Popen(r'"C:\Program Files\Internet Explorer\IEXPLORE.EXE"')

If you plan to use the script in more than your machine, keep in mind that not everyone has a English version of Windows

import subprocess
import os

subprocess.Popen(r'"' + os.environ["PROGRAMFILES"] + '\Internet Explorer\IEXPLORE.EXE"')

Please try putting the absolute path of internet explorer exe file in your code.

ie=webbrowser.get("C:\Program Files\Internet Explorer\iexplore.exe")

Need Your Help

Java - resize image without losing quality

java image image-processing bufferedimage

I have 10,000 photos that need to be resized so I have a Java program to do that. Unfortunately, the quality of the image is poorly lost and I don't have access to the uncompressed images.

How do you close a jQuery Simplemodal?

jquery ajax simplemodal

I want to close a Simplemodal window from a JavaScript function that gets called automatically after a form is submitted and the results recived (AJAX), using ASP.Net MVC. How do I close a jQuery