From d10f73cc0184ef93e042c381eadc6f09642b52ee Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Fri, 23 May 2014 20:20:08 -0400 Subject: Support extensions as modules. Fixes #300. When a python module (.../__init__.py) is imported by `__import__` and the `from_list` argument is a unicode string (as is returned by rpartition), then an error is raised in Python 2.7. Force conversion to default string type (byte in 2.7 and unicode in 3) to avoid the error. For a full explaination, see issue [300](https://github.com/waylan/Python-Markdown/issues/300). --- markdown/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdown/__init__.py b/markdown/__init__.py index 4943388..378f873 100644 --- a/markdown/__init__.py +++ b/markdown/__init__.py @@ -194,7 +194,7 @@ class Markdown(object): # Try loading the extension first from one place, then another try: # New style (markdown.extensions.) - module = __import__(module_name, {}, {}, [module_name.rpartition('.')[0]]) + module = __import__(module_name, {}, {}, [str(module_name.rpartition('.')[0])]) except ImportError: module_name_old_style = '_'.join(['mdx', ext_name]) try: # Old style (mdx_) -- cgit v1.2.3