Home Download Buy Blog Forum Support

Unable to open web browser from Sublime Text 2

Unable to open web browser from Sublime Text 2

Postby BlackYeLL on Thu Aug 02, 2012 2:57 pm

Hello,

I'm using Linux (same problem on Linux Mint & Kubuntu).

First, I installed the "Can I Use" plugin, which can open a webbrowser to the site caniuse.com from a keyword in a CSS file. But it doesn't open anything.

I thought the plugin was broken, but on a HTML file, right click + "Open in Browser" doesn't work either.

So I start to search, and search, and search...

Finaly, I found something.

When I type this :

Code: Select all
import webbrowser
webbrowser.get()


In the Sublime Text console, I got : webbrowser.Error: could not locate runnable browser
In the Python console (Linux Terminal), I got : <webbrowser.BackgroundBrowser object at 0x25f5910>

Obviously, if I type this :

Code: Select all
import webbrowser
webbrowser.open_new_tab('http://google.com')


In the Sublime Text console, it returns false and nothing happens.
In the Python console (Linux Terminal), it returns true and my web browser open the page.

So, why the webbrowser doesn't work inside Sublime Text 2 ?

Thank you :)
BlackYeLL
 
Posts: 7
Joined: Fri Jul 08, 2011 1:42 pm

Re: Unable to open web browser from Sublime Text 2

Postby retrovertigo on Sun Aug 12, 2012 2:10 am

:!: Answered it - see below

I have the same issue on my Mac and ran BlackYeLL first test (no idea about Python - so I didn't run the second one)

With a different outcome:

Code: Select all
import webbrowser
webbrowser.get()
<webbrowser.MacOSX object at 0x10c667190>


Any idea why it's not working?

Thanks!

:idea: Sublime Text 2 was set as my default app for html files. The 'Open in browser' command was triggering this default app - not a browser. Changed it back to Firefox and it is working ...
retrovertigo
 
Posts: 1
Joined: Sun Aug 12, 2012 2:03 am

Re: Unable to open web browser from Sublime Text 2

Postby JayBoyB on Sun Sep 02, 2012 6:41 am

Interesting variation on the problem for me....

I couldn't open files with 'Open in Browser'.
the console window (crtl + `) showed :

IOError: [Errno 2] No such file or directory: u'/Volumes/HD/WEB SITE FILES/testProject.sublime-project'
reloading /Users/XX/Library/Application Support/Sublime Text 2/Packages/User/Fetch.sublime-settings

I'd deleted a project file that included the directory of the file I was trying to browse.
Retrieving the project file from Trash made everything work again.

:)
JayBoyB
 
Posts: 1
Joined: Sun Sep 02, 2012 6:35 am


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 21 guests