title: webbrowser.open() in python
body: <p>I have a python file <code>html_gen.py</code> which write a new <code>html</code> file <code>index.html</code> in the same directory, and would like to open up the <code>index.html</code> when the writing is finished.</p>
  
  <p>So I wrote</p>
  
  <pre><code>import webbrowser
  webbrowser.open("index.html");
  </code></pre>
  
  <p>But nothing happen after executing the .py file. If I instead put a code</p>
  
  <pre><code>webbrowser.open("http://www.google.com")
  </code></pre>
  
  <p>Safari will open google frontpage when executing the code.</p>
  
  <p>I wonder how to open the local index.html file?</p>