Python, webbrowser, OS X, and "execution error"

Once in awhile I write Python scripts which produce static HTML pages and then use the webbrowser module to open the results in a browser. I do this just rarely enough that, when the scripts fail on OS X with the following error, I have to waste time diagnosing the problem:

execution error: An error of type -2110 has occurred. (-2110)

Despite the obscure phrasing, the cause of the error is simple. I'm passing a filesystem pathname to, when I should be passing a file: URL.

This produces the error:"/path/to/file.html")

This works:"file:///path/to/file.html")