Commits

Rafal Chlodnicki committed ae52054

Fixed importing of modules.

Python 2.6 does not allow old usage of __import__(name) anymore.
Plus there were incorrect assumptions about path separator which did not
match Windows platform.

  • Participants
  • Parent commits d1e271a

Comments (0)

Files changed (1)

 
 import sys
 import re
+import os.path
 
 import sublime
 import sublime_plugin
     files = glob('%s/*.py' % path)
     available_resolvers = dict()
     for pos, file_ in enumerate(files[:]):
-        name = splitext(file_)[0].replace('/', '.')
-        __import__(name)
-        module = reload(sys.modules[name])
+        name = os.path.splitext(file_)[0]
+        patharr = name.split(os.path.sep)
+        module, name = '.'.join(patharr), patharr[-1:]
+        module = __import__(module, globals(), locals(), name)
+        module = reload(module)
         if '__init__' in file_ or 'abstract' in file_:
             continue
-        name = name.split('.').pop()
+        name = name[0]
         # print name, module
         available_resolvers[name] = module
     return available_resolvers