cpbotha / nvpy

Simplenote syncing note-taking application, inspired by Notational Velocity and ResophNotes, but uglier and cross-platformerer.
Other
849 stars 114 forks source link

config file's 'md_extensions' setting causes traceback if delimited with multiple spaces #201

Closed ernstki closed 4 years ago

ernstki commented 4 years ago

Python 3.6.3 on Ubuntu 18.04, using latest nvpy (2.0.2) from GitHub.

But the shipped example config has two spaces between markdown.extensions.codehilite and markdown.extensions.tables for the md_extensions setting:

# extensions for markdown.py                                                
# if you use multiple extensions, separate with spaces.                     
# md_extensions = markdown.extensions.codehilite  markdown.extensions.tables

This is probably misinterpreted by a split() somewhere, resulting in this backtrace when you use Ctrl+M to render Markdown:

Traceback: ValueError: Empty module name
2020-01-16 01:35:08,146 - ERROR - Traceback (most recent call last):
  File "/usr/lib/python3.6/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "/home/myuser/.local/lib/python3.6/site-packages/nvpy/view.py", line 1565, in cmd_markdown
    self.notify_observers('command:markdown', None)
  File "/home/myuser/.local/lib/python3.6/site-packages/nvpy/utils.py", line 205, in notify_observers
    self.__invoke_observer(o, evt_type, evt)
  File "/home/myuser/.local/lib/python3.6/site-packages/nvpy/utils.py", line 229, in __invoke_observer
    observer(self, event_type, event)
  File "/home/myuser/.local/lib/python3.6/site-packages/nvpy/debug.py", line 30, in wrapper
    return fn(*args, **kwargs)
  File "/home/myuser/.local/lib/python3.6/site-packages/nvpy/tk.py", line 30, in wrapper
    return fn(*args, **kwargs)
  File "/home/myuser/.local/lib/python3.6/site-packages/nvpy/nvpy.py", line 610, in observer_view_markdown
    fn = self.helper_markdown_to_html()
  File "/home/myuser/.local/lib/python3.6/site-packages/nvpy/nvpy.py", line 541, in helper_markdown_to_html
    html = markdown.markdown(c, extensions=exts)
  File "/home/myuser/.local/lib/python3.6/site-packages/markdown/__init__.py", line 493, in markdown
    md = Markdown(*args, **kwargs)
  File "/home/myuser/.local/lib/python3.6/site-packages/markdown/__init__.py", line 159, in __init__
    configs=kwargs.get('extension_configs', {}))
  File "/home/myuser/.local/lib/python3.6/site-packages/markdown/__init__.py", line 185, in registerExtensions
    ext = self.build_extension(ext, configs.get(ext, {}))
  File "/home/myuser/.local/lib/python3.6/site-packages/markdown/__init__.py", line 231, in build_extension
    module = importlib.import_module(ext_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 991, in _gcd_import
  File "", line 930, in _sanity_check
ValueError: Empty module name