timonwong / OmniMarkupPreviewer

Sublime Text 2&3 plugin to live preview markup files, supported (not limited to) markup formats are markdown, reStructuredText, WikiCreole and textile.
MIT License
500 stars 74 forks source link

Update broke it - 404 #50

Closed vongoh closed 10 years ago

vongoh commented 10 years ago

Hi, got the update a few minutes ago. Used Ctrl+Alt+O to check out a markdown doc and

Error: 404 Not Found

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

buffer_id(28) is not valid (closed or unsupported file format)
timonwong commented 10 years ago

@vongoh Hi, can you bring up your console (Ctrl+`), and paste its contents here?

And after update, you may have to restart sublime text sometimes.

cgarrard commented 10 years ago

I was seeing the same thing but today's update seems to have fixed it (but I'm having another problem, that I'll open another issue for). Just for reference, here's what was in my console when I got this particular error:

OmniMarkupPreviewer: [INFO] Launching web browser for http://localhost:51004/view/60
OmniMarkupPreviewer: [ERROR] Exception occured while rendering using MarkdownRenderer
  Traceback (most recent call last):
    File "C:\Users\chrisg\AppData\Roaming\Sublime Text 3\Packages\OmniMarkupPreviewer\OmniMarkupLib\RendererManager.py", line 266, in render_text
    rendered_text = renderer.render(text, filename=filename)
    File "C:\Users\chrisg\AppData\Roaming\Sublime Text 3\Packages\OmniMarkupPreviewer\OmniMarkupLib\Renderers/MarkdownRenderer.py", line 36, in render
    extensions=self.extensions)
  AttributeError: 'MarkdownRenderer' object has no attribute 'extensions'
vongoh commented 10 years ago

Sry, did not have a chance to respond earlier with the console data.

The new update seems to have fixed my original issue - the preview opens fine. I cannot speak to cgarrad's issue, has not happened for me here yet.

arxpoetica commented 9 years ago

I was having the same issue reported here (buffer_id([#]) is not valid (closed or unsupported file format)) and hunted down a probable cause of the problem. If you're running two versions of Sublime (Sublime 2 and Sublime 3) and you have the plugin running in both instances at the same time, OmniMarkupPreviewer will try to connect to a websocket on the the same port (51004). It's a rare case—might want to open a new ticket for it? I'll copy this comment into a new issue and let you decide what you want to do about it.

balboah commented 7 years ago

Hitting this problem as well in most recent sublime text 3 omnimarkup running on OSX:

OmniMarkupPreviewer: [INFO] Launching web browser for http://127.0.0.1:51004/view/62
/Users/johnny/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/__init__.py:277: DeprecationWarning: Markdown's behavior of prepending "mdx_" to an extension name is deprecated. Use the full path to the extension with Python's dot notation (eg: "mdx_strikeout" instead of "strikeout"). The current behavior will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
  DeprecationWarning)
/Users/johnny/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/extensions/__init__.py:49: DeprecationWarning: Extension classes accepting a dict on the single keyword "config" is pending Deprecation. Each setting should be passed into the Class as a keyword directly. The "config" keyword is deprecated and raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
  DeprecationWarning)
OmniMarkupPreviewer: [ERROR] Exception occured while rendering using MarkdownRenderer
  Traceback (most recent call last):
    File "/Users/johnny/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/johnny/Library/Application Support/Sublime Text 3/Packages/OmniMarkupPreviewer/OmniMarkupLib/Renderers/MarkdownRenderer.py", line 48, in render
    extensions=self.extensions)
    File "/Users/johnny/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/__init__.py", line 493, in markdown
    md = Markdown(*args, **kwargs)
    File "/Users/johnny/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/__init__.py", line 159, in __init__
    configs=kwargs.get('extension_configs', {}))
    File "/Users/johnny/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/johnny/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/__init__.py", line 291, in build_extension
    return module.makeExtension(**configs)
    File "/Users/johnny/Library/Application Support/Sublime Text 3/Packages/OmniMarkupPreviewer/OmniMarkupLib/Renderers/libs/mdx_strikeout.py", line 17, in makeExtension
    return StrikeoutExtension(configs=configs)
    File "/Users/johnny/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/extensions/__init__.py", line 51, in __init__
    self.setConfigs(kwargs)
    File "/Users/johnny/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/extensions/__init__.py", line 82, in setConfigs
    self.setConfig(key, value)
    File "/Users/johnny/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'

The config is the default and has not been customized:

"extensions": ["tables", "strikeout", "fenced_code", "codehilite"]
balboah commented 7 years ago

Solution was to remove omnimarkup, then manually delete Pacakges/python-markdown and reinstall omnimarkup again.

leafiy commented 7 years ago

mniMarkupPreviewer: [ERROR] Exception occured while rendering using MarkdownRenderer Traceback (most recent call last): File "/Users/leafiy/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/leafiy/Library/Application Support/Sublime Text 3/Packages/OmniMarkupPreviewer/OmniMarkupLib/Renderers/MarkdownRenderer.py", line 48, in render extensions=self.extensions) File "/Users/leafiy/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/__init__.py", line 493, in markdown md = Markdown(*args, **kwargs) File "/Users/leafiy/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/__init__.py", line 159, in __init__ configs=kwargs.get('extension_configs', {})) File "/Users/leafiy/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/leafiy/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/__init__.py", line 291, in build_extension return module.makeExtension(**configs) File "/Users/leafiy/Library/Application Support/Sublime Text 3/Packages/OmniMarkupPreviewer/OmniMarkupLib/Renderers/libs/mdx_superscript.py", line 43, in makeExtension return SuperscriptExtension(configs=configs) File "/Users/leafiy/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/extensions/__init__.py", line 51, in __init__ self.setConfigs(kwargs) File "/Users/leafiy/Library/Application Support/Sublime Text 3/Packages/python-markdown/st3/markdown/extensions/__init__.py", line 82, in setConfigs self.setConfig(key, value) File "/Users/leafiy/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'

balboah commented 7 years ago

@leafiy see my comment

balboah commented 7 years ago

for some reason, I get the issue once again as soon as I restart sublime though. Following these steps:

  1. Omnimarkup preview doesn't work
  2. rm -rf Packages/python-markdown
  3. Restart sublime = preview works!
  4. Restart sublime again = preview doesn't work anymore
  5. repeate from step 1
balboah commented 7 years ago

There's a workaround for the problem in https://github.com/timonwong/OmniMarkupPreviewer/issues/85

vongoh commented 7 years ago

@balboah - Thanks for the pointer to #85, Option 1 worked for me.

However, I'm still getting the issue without it:

Error:

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.

Console:

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