This explains my issue very well:
http://www.sublimetext.com/forum/viewtopic.php?f=3&t=8513
Running the following command in python interactive terminal works, but not when added as a sublime text 2 plugin:
import webbrowser
webbrowser.open_new_tab('http://google.com')
I need to preview an HTML page in a browser.
EDIT: In sublime text I get something like:
webbrowser.Error: could not locate runnable browser
EDIT
I even tried this:
import sublime, sublime_plugin
import webbrowser
from subprocess import call
class OpenBrowserCommand(sublime_plugin.TextCommand):
def run(self,edit):
url = self.view.file_name()
url = '"file://{url}"'.format(url=url)
firefox = '"/Applications/Firefox.app"'
print url
call(["open", "-a", firefox, url])