Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 error on preview ... "buffer_id(29) is not valid (closed or unsupported file format)" #85

Open
BirdyOz opened this issue Dec 1, 2015 · 35 comments

Comments

@BirdyOz
Copy link

BirdyOz commented Dec 1, 2015

When I attempt to preview a MD file, I get the following error in the browser:

"Error: 404 Not Found
Sorry, the requested URL 'http://127.0.0.1:51004/view/29' caused an error:

'buffer_id(29) is not valid (closed or unsupported file format)'

NOTE: If you run multiple instances of Sublime Text, you may want to adjust
the server_port option in order to get this plugin work again."

This is what I see in the console:

OmniMarkupPreviewer: [INFO] Launching web browser for http://127.0.0.1:51004/view/29
OmniMarkupPreviewer: [ERROR] Exception occured while rendering using MarkdownRenderer
Traceback (most recent call last):
File "/Users/BirdyOz/Library/Application Support/Sublime Text 3/Packages/OmniMarkupPreviewer/OmniMarkupLib/RendererManager.py", line 266, in render_text
rendered_text = renderer.render(text, filename=filename)
File "/Users/BirdyOz/Library/Application Support/Sublime Text 3/Packages/OmniMarkupPreviewer/OmniMarkupLib/Renderers/MarkdownRenderer.py", line 48, in render
extensions=self.extensions)
File "/Users/BirdyOz/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/init.py", line 493, in markdown
md = Markdown(_args, *_kwargs)
File "/Users/BirdyOz/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/init.py", line 159, in init
configs=kwargs.get('extension_configs', {}))
File "/Users/BirdyOz/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/init.py", line 185, in registerExtensions
ext = self.build_extension(ext, configs.get(ext, {}))
File "/Users/BirdyOz/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/init.py", line 291, in build_extension
return module.makeExtension(**configs)
File "/Users/BirdyOz/Library/Application Support/Sublime Text 3/Packages/OmniMarkupPreviewer/OmniMarkupLib/Renderers/libs/mdx_strikeout.py", line 17, in makeExtension
return StrikeoutExtension(configs=configs)
File "/Users/BirdyOz/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/extensions/init.py", line 51, in init
self.setConfigs(kwargs)
File "/Users/BirdyOz/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/extensions/init.py", line 82, in setConfigs
self.setConfig(key, value)
File "/Users/BirdyOz/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/extensions/init.py", line 70, in setConfig
if isinstance(self.config[key][0], bool):
KeyError: 'configs'

I have read other issue resolutions. I do not have multiple versions of ST running. I have tried the "fix" whereby you change the ports, but this did not resolve the issue.

@jfcherng
Copy link

Did you get ScopeHunter installed?

The python-markdown extension which is introduced by ScopeHunter could cause this error...
Disabling ScopeHunter won't help but uninstalling it helps.
I don't know who should be responsible for this and how to make them co-exist.

@jfcherng
Copy link

@timonwong Maybe we could use dependencies in package control as facelessuser mentioned in facelessuser/ScopeHunter#28 (comment) for better compatibility with other plugins?
It seems that the latest stable version of python-markdown goes to 2.6.5 now.

@facelessuser
Copy link

Using the dependency might be difficult for OmniMarkdownPreview because the dependency (which I maintain) does not have ST2 support which so far was a conscious move. If someone where willing to support a ST2 variant, I wouldn't be against adding it, I am just not sure if I want that extra work for something I don't really use anymore; I only use ST3.

Python Markdown no longer supports Python 2.6 in the latest releases (which ST2 uses), so in order to maintain a ST2/ST3 dependency, Python 2.6 support has to be preserved every time time you merge, and you have to evaluate that all new changes are Python 2.6 compatible. Maintaining Python 2.6 support isn't too bad right now as Python Markdown 2 is right now in bug fixes only mode. But when Python Markdown 3 is one day released, there will be a lot of work that would need to be done to get 3.0 support backported to Python 2.6. Work that I am just not interested in.

It is possible that Markdown 3 might not ever get merged into the Sublime dependencies as they plan on separating out all the extensions and using entry points to import the plugins. I am not sure yet how well that will play in the Sublime environment. If entry points don't work well in Sublime then we would probably need to stick with Markdown 2 releases, or overhaul the framework to work with Sublime. If the dependency never gets upgraded to 3 then ST2/ST3 wouldn't be that bad as no new features are planned for the Markdown 2 releases.

If you want to vendor the latest, you can can get a Python 2.6 compatible release of Markdown 2.6.5 found in Markdown Preview. You would have to remove a couple of custom extensions, but other than that, you just drop it in and call in relatively. I personally upgraded Markdown Preview's markdown version, but it is probably the last upgrade I plan on doing as I don't actively use Markdown Preview much anymore.

@scuml
Copy link

scuml commented Dec 30, 2015

Quick Fix 1: Remove Strikethrough Extension

Sublime Text > Preferences > Package Settings > OmniMarkupPreviewer > Settings - User
paste the following to remove the strikeout package.

{
    "renderer_options-MarkdownRenderer": {
        "extensions": ["tables", "fenced_code", "codehilite"]
    }
}

Quick Fix 2: Fix the Strikethrough Extension (if you need it)

Find the python-markdown sublime package.

On the Mac: subl "/Users/<username>/Library/Application Support/Sublime Text 3/Packages/OmniMarkupPreviewer/OmniMarkupLib/Renderers/libs/mdx_strikeout.py"

Replace the makeExtension() method with the following:

def makeExtension(*args, **kwargs):
    return StrikeoutExtension(*args, **kwargs)

Save, quit and reload Sublime Text.

@jfcherng
Copy link

@scuml Thanks, I am using Quick Fix 1 and it works.

@jnns
Copy link

jnns commented Mar 17, 2016

Related, most likely a duplicate: #93

@Spacebody
Copy link

Thanks. Quick Fix 1 works

@eromoe
Copy link

eromoe commented Sep 5, 2016

Quick Fix 1 should be the default settings.
But Latest commit 21921ac on 15 Jun 2015, seems no more maintain ?

It because sublimetext-markdown-preview was so slow to show a preview that I switched to OmniMarkupPreviewer.
Just now, I looked back to markdown-preview and found add below config could make it as fast as this:

{
    "parser": "markdown",
    "enabled_parsers": ["markdown"]
}

@crossingmay
Copy link

crossingmay commented Sep 6, 2016

@scuml Thank u! Quick Fix 2 works!~

@yangjiannan2018
Copy link

using Quick Fix 1 works for me ~
thx!

@YeomanYe
Copy link

YeomanYe commented Oct 1, 2016

@scuml Thanks! Quick Fix 1 works

@clayclayclay
Copy link

Thank you Quick Fix 1 works @scuml

@fhybj
Copy link

fhybj commented Oct 10, 2016

@scuml Thanks! Quick Fix 1 works

@Suor
Copy link

Suor commented Oct 27, 2016

Quick Fix 2 prevents live and non-live updates for me. Even when I close page and reopen I can't see changes to a file.

@naifan
Copy link

naifan commented Nov 16, 2016

@scuml Thanks! Quick Fix 1 works for me

@ringcrl
Copy link

ringcrl commented Dec 16, 2016

Thanks. Quick Fix 1 works

jlknuth pushed a commit to jlknuth/SublimeTextJLK that referenced this issue Jan 4, 2017
@persiliao
Copy link

Thanks. Quick Fix 1 works

@echohuub
Copy link

@scuml Thanks. Quick Fix 1 works

@JiaxinZhuang
Copy link

@scuml Thanks.Quick Fix 1 works

@ouweiya
Copy link

ouweiya commented Jul 10, 2017

Thanks. Quick Fix 1 works

@Oaklight
Copy link

Quick fix 2 works. Thanks.

@mysterin
Copy link

mysterin commented Sep 7, 2017

Quick fix 1 works, Thanks.

@dbrandydude
Copy link

Awesome, fix 1 works. Thanks!

@mambo4
Copy link

mambo4 commented Oct 24, 2017

@scuml fix 1 did the trick for me, thanks

@vongoh
Copy link

vongoh commented Nov 21, 2017

Fix #1 FTW

@woshixixi
Copy link

@scuml fixed, thanks!!!!

@brelian
Copy link

brelian commented Dec 4, 2017

@scuml fixed +1. tks!

@zehuichen123
Copy link

zehuichen123 commented Dec 19, 2017

@scuml I've tried the two quick fix ways but both of them didn't work. As you can see, I've modified mdx_strikeout.py:

import markdown
from markdown.inlinepatterns import SimpleTagPattern


STRIKEOUT_RE = r'(\~\~)([^\s](?:.*))(\~\~)'


class StrikeoutExtension(markdown.Extension):
    """ Strikeout extension for Python-Markdown. """

    def extendMarkdown(self, md, md_globals):
        """ Modifies inline patterns. """
        md.inlinePatterns.add('del', SimpleTagPattern(STRIKEOUT_RE, 'del'), '<not_strong')


def makeExtension(*args, **kwargs):
    return StrikeoutExtension(*args, **kwargs)

and modified OmniMakeupPreviewer settings-user like this:

{
	"missing_module_reported": true,
	"renderer_options-MarkdownRenderer": {
        "extensions": ["tables", "fenced_code", "codehilite"]
    }
}

Then reload my sublime but I still get a 404:

Error: 404 Not Found

Sorry, the requested URL 'http://127.0.0.1:51004/view/28' caused an error:

'buffer_id(28) is not valid (closed or unsupported file format)'

**NOTE:** If you run multiple instances of Sublime Text, you may want to adjust
the `server_port` option in order to get this plugin work again.

Can anyone help me or did I do something wrong? I just want to preview my restructured text :(

@izackwu
Copy link

izackwu commented Dec 24, 2017

Thanks. Quick Fix 1 does help.

@geekyouth
Copy link

geekyouth commented Mar 7, 2020

extensions error, ImportError: No module named 'tables' https://gitmemory.com/issue/timonwong/OmniMarkupPreviewer/138/562414026

Preferences > Package Settings > OmniMarkupPreviewer > Settings - User

{
    "server_host": "0.0.0.0",
    "server_port": 51004,
    "renderer_options-MarkdownRenderer":
    {
        "extensions": ["markdown.extensions.tables", "markdown.extensions.fenced_code", "markdown.extensions.codehilite"]
    }
}

it works on my sublime version 3.2.2-3211
🤞

@crliu95
Copy link

crliu95 commented Mar 11, 2020

Quick Fix 1 should be the default settings.
But Latest commit 21921ac on 15 Jun 2015, seems no more maintain ?

It because sublimetext-markdown-preview was so slow to show a preview that I switched to OmniMarkupPreviewer.
Just now, I looked back to markdown-preview and found add below config could make it as fast as this:

{
    "parser": "markdown",
    "enabled_parsers": ["markdown"]
}

Have tried the both methods (each at one time), but failed.

@chenrenyi
Copy link

Remove package "markdownpreview" works for me

@hahaxy
Copy link

hahaxy commented Jun 1, 2020

extensions error, ImportError: No module named 'tables' https://gitmemory.com/issue/timonwong/OmniMarkupPreviewer/138/562414026

Preferences > Package Settings > OmniMarkupPreviewer > Settings - User

{
    "server_host": "0.0.0.0",
    "server_port": 51004,
    "renderer_options-MarkdownRenderer":
    {
        "extensions": ["markdown.extensions.tables", "markdown.extensions.fenced_code", "markdown.extensions.codehilite"]
    }
}

it works on my sublime version 3.2.2-3211
🤞

Thanks, this works for me

@deb-intel
Copy link

Quick Fix 1: Remove Strikethrough Extension worked for me! Thanks SO much!

@ZhouLiHai
Copy link

extensions error, ImportError: No module named 'tables' https://gitmemory.com/issue/timonwong/OmniMarkupPreviewer/138/562414026

Preferences > Package Settings > OmniMarkupPreviewer > Settings - User

{
    "server_host": "0.0.0.0",
    "server_port": 51004,
    "renderer_options-MarkdownRenderer":
    {
        "extensions": ["markdown.extensions.tables", "markdown.extensions.fenced_code", "markdown.extensions.codehilite"]
    }
}

it works on my sublime version 3.2.2-3211
🤞

Thanks, this works for me

It works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests