Reputation: 79
I am using a particular version of Python (v 2.7.0) that doesn't allow me to use webbrowser or selenium libraries.
It also doesn't recognise os.startfile.
Is there another module to use that allows me to open up a locally addressed html file in my browser?
Upvotes: 0
Views: 808
Reputation: 79
I fumbled on a result by treating it as an exe and project. Subprocess module worked. Tested a little further and should work for Jython 2.7.0 also.
import subprocess as sp
sp.Popen(["browser_exe_path","html_path"])
Note - if using brave browser - it's exe wasn't recognised. chrome_proxy.exe worked in it's place.
Happy to learn something via feedback.
Upvotes: 0
Reputation: 24582
Since you are using windows you can use os.startfile
which will start a file with its associated application.
>>> import os
>>> os.startfile("PATH_TO_HTML_FILE")
Upvotes: 1