Skip to content
This repository was archived by the owner on May 17, 2018. It is now read-only.

Commit 180e27c

Browse files
committed
fix ST2 import error :/ for #166
1 parent 158eb0a commit 180e27c

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

markdown/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@
3838
import sys
3939
import sublime
4040
import logging
41-
import importlib
41+
try:
42+
# ST3
43+
import importlib
44+
except ImportError:
45+
# ST2
46+
pass
4247
from . import util
4348
from .preprocessors import build_preprocessors
4449
from .blockprocessors import build_block_parser
@@ -202,7 +207,10 @@ def build_extension(self, ext_name, configs = []):
202207

203208
# Try loading the extension first from one place, then another
204209
try: # New style (markdown.extensons.<extension>)
205-
module = importlib.import_module(module_name)
210+
if 'importlib' in globals():
211+
module = importlib.import_module(module_name)
212+
else:
213+
module = __import__(module_name, {}, {}, [module_name.rpartition('.')[0]])
206214
except ImportError:
207215
module_name_old_style = '_'.join(['mdx', ext_name])
208216
try: # Old style (mdx_<extension>)

0 commit comments

Comments
 (0)