I have written a Python program using Python 3.3. The output is saved as an HTML file. I want the HTML file to pop open automatically and show the results at the end of the program. Is there ay solution for this? I'll appreciated your help. Thanks
Asked
Active
Viewed 963 times
1 Answers
1
This should work:
>>> import webbrowser
>>> webbrowser.get('/usr/bin/google-chrome %s').open('http://google.com')
True
**This will open the Chrome web browser with the Google's homepage.
Change the url path
to the file path
of the html page and use file://{ followed by the html page path }
>>> webbrowser.get('/usr/bin/google-chrome %s').open('file://the/path/to/the/html/page')
Updated:
Try:
>>> webbrowser.get('windows-default').open('{ url path for static html page }')
Reference: python's webbrowser launches IE instead of default on windows 7

Community
- 1
- 1

Viren Rajput
- 5,426
- 5
- 30
- 41
-
Thanks for your help. I tried it out. No errors but still the browser doesn't pop open :( – Feb 04 '13 at 14:26
-
@user3017348 - did you check for pop up blocker? – loveR Dec 09 '19 at 12:38