revolunet / sublimetext-markdown-preview

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

Can't open preview from sublime text 2 #21

Closed mathieubodin closed 12 years ago

mathieubodin commented 12 years ago

Hi, I'm facing an issue with this plugin on a LinuxMint distribution (v13). Can't get it to launch the preview. In the console, i've got :

Traceback (most recent call last):
  File "./sublime_plugin.py", line 356, in run_
  File "./MarkdownPreview.py", line 92, in run
  File "./desktop/__init__.py", line 277, in open
OSError: Desktop 'X11' not supported (neither DESKTOP_LAUNCH nor os.startfile could be used)

It might be a configuration problem but which one ?

I first add a comment on https://github.com/revolunet/sublimetext-markdown-preview/issues/2 and figure out later that it was closed so there aren't any chance to get it known...

revolunet commented 12 years ago

looks like the desktop module has an issue with some linux distros. i have to dig into this. or if you want to contribute, you may start here : http://bugs.python.org/issue1301512

revolunet commented 12 years ago

i merged a PR about xdg-open yesterday. can you please update and tell me if its ok ?

mathieubodin commented 12 years ago

Thanks a lot ! Now, it open in browser perfectly, and open the html in sublime text. Works great !

Sorry for the delay...

leucos commented 11 years ago

This still fails with ArchLinux. I get this with st2 :

Traceback (most recent call last):
  File "./sublime_plugin.py", line 356, in run_
  File "./MarkdownPreview.py", line 168, in run
  File "./desktop/__init__.py", line 286, in open

OSError: Desktop 'X11' not supported (neither DESKTOP_LAUNCH nor os.startfile could be used)

I used Package Manager for install (may be the fix is only on the GH repos and not available in PM ?)

xdg-open at the command line works fine.

Thanks.

eddie-dunn commented 11 years ago

Yes, this issue needs to be reopened, as it seems to fail on Linux unless you are running any of the commonly used desktop environments (KDE, Gnome, MATE, XFCE). I "fixed" this behavior locally by adding this into def open in desktop/__init__.py:

def open(url, desktop=None, wait=0):
    ...
    elif desktop_in_use == "X11":
        cmd = ["xdg-open", url]
    ...

Not sure how valid this fix is, but at least it works as long as you can run xdg-open.

revolunet commented 11 years ago

just added this fallback, please confirm, thanks @eddie-dunn

eddie-dunn commented 11 years ago

Yes, it works! :)