[FIXED] Python : Opening local html file on browser without using Webbrowser or Selenium

Issue

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?


Solution

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.



Answered By - Mark Quinn
Answer Checked By - Dawn Plyler (Python.Easybugfix Volunteer)

Related Posts

Post a Comment