revolunet / sublimetext-markdown-preview

markdown preview and build plugin for sublime text 2/3
MIT License
2.31k stars 362 forks source link

Preview in Browser command fails ("cannot execute none") #31

Closed 100ideas closed 12 years ago

100ideas commented 12 years ago

On my system (OS.X 10.7.4, SublimeText2 2217), I have a problem. I can see the command execute from the ST2 terminal, but a dialog pops up:

cannot execute none Please check your Markdown Preview settings

The settings file, MarkdownPreview.sublime-settings, has the browser set to

"browser": "default"

I commented it out and tried replacing it with

"browser": "/Applications/Google Chrome.app"

But I got the same error. So I tried hacking to source file, MarkdownPreview.py. On line 107, I replaced

cmd = '"%s" %s' % (config_browser, tmp_fullpath)

with a hardcoded link to my Chrome application

cmd = '"/Applications/Google Chrome.app" %s' % (tmp_fullpath)

This resolved the problem. Now running the Markdown Preview: preview in browser command successfully executes and opens chrome with the converted and styled text. So I suspect there is a bug in how the MarkdownPreview plugin is reading it's config file (correct paths etc etc?).

Cheers Mac

P.S. Here is some info on what version of the package I have, from Markdown Preview/package-metadata.jason:

{"url": "https://github.com/revolunet/sublimetext-markdown-preview", "version": "2012.09.06.19.15.57", "description": "markdown preview plugin for sublime text 2"}
100ideas commented 12 years ago

I poked around a little bit more. I think there is a typo on line 107 of MarkdownPreview.py. Changing

cmd = '"%s" %s' % (config_browser, tmp_fullpath)

to

cmd = '%s %s' % (config_browser, tmp_fullpath)

resolved the issue for me.

revolunet commented 12 years ago

thanks fo reporting, this is my yesterday fix :) Looks like its working for other guys and myself. can you add this line in the markdownpreview.py and tell me what you get in the console please ?

print settings.get('browser')

the double quotes are necessary for paths with spaces

100ideas commented 12 years ago

Oddly, none of the print statements are outputting to ST2 console, even the preexisting ones. I just did a clean install of the plugin, and more oddly, it's working as it was supposed to. So... perhaps there was something unusual with how my system was set up earlier. I'll report back later after a system restart.

Google chrome should be set as my default browser (via the safari control panel) & handler of html files.

revolunet commented 12 years ago

ok thanks for trying it ! i guess there are some issues with plugin reloading and not finding the settings or something like that...

you got none or None with a capital N ?

spiritofnine commented 12 years ago

I'm getting this error:

cannot execute "None" Please check your Markdown Preview settings

I've installed, uninstalled, and reinstalled and the problem persists. I don't have a file named markdownpreview.py but I do have MarkdownPreview.py. I added the following statement after the require statements:

print settings.get('browser')

But nothing is printed. Console shows:

Markdown Preview: executing open -a "None" /var/folders/ls/bd5spf8s48l1gj6cbgv7n_fw0000gn/T/27.html
error: cannot execute "None" Please check your Markdown Preview settings
revolunet commented 12 years ago

thanks for reporting, please confirm that it works now

spiritofnine commented 12 years ago

Yep, it works now. Thanks!

100ideas commented 12 years ago

Works for me too. Thanks.