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

Commit

Permalink
fix ST2 import error :/ for #166
Browse files Browse the repository at this point in the history
  • Loading branch information
revolunet committed Jan 29, 2014
1 parent 158eb0a commit 180e27c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions markdown/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
import sys
import sublime
import logging
import importlib
try:
# ST3
import importlib
except ImportError:
# ST2
pass
from . import util
from .preprocessors import build_preprocessors
from .blockprocessors import build_block_parser
Expand Down Expand Up @@ -202,7 +207,10 @@ def build_extension(self, ext_name, configs = []):

# Try loading the extension first from one place, then another
try: # New style (markdown.extensons.<extension>)
module = importlib.import_module(module_name)
if 'importlib' in globals():
module = importlib.import_module(module_name)
else:
module = __import__(module_name, {}, {}, [module_name.rpartition('.')[0]])
except ImportError:
module_name_old_style = '_'.join(['mdx', ext_name])
try: # Old style (mdx_<extension>)
Expand Down

0 comments on commit 180e27c

Please sign in to comment.