webbrowser.open("./documentation/help.html")-- No Go in Windows

llanitedave llanitedave at veawb.coop
Mon Feb 25 04:37:35 CET 2013


Well, we can mark this one as solved.

Simple enough, actually -- thanks to Chris and Demian for leading me to water.

The following code works on both Linux and Windows 7:

def OnDocs(self, event):
        """Opens the User's Guide in the default web browser"""
        fullpath = os.path.abspath('documentation/HTMLDocs/index.html')
        url_link = "file:///" + fullpath
        webbrowser.open(url_link)

This allows both platforms to have their own idiosyncratic path structures without having to create separate code for each.  It even chooses the correct browser!

I learned some more about Python today, too. I'd never explored the 'os.' library before, and now I see things a little more clearly.

Thanks again, guys!



More information about the Python-list mailing list