]> jfr.im git - erebus.git/commitdiff
hopefully fix module name conflicts
authorzonidjan <redacted>
Thu, 10 Sep 2015 06:23:26 +0000 (01:23 -0500)
committerzonidjan <redacted>
Thu, 10 Sep 2015 06:23:26 +0000 (01:23 -0500)
ctlmod.py

index 8cfa7d04e34d3b2d4d7afa9686b6e5177ed7fa2e..0a4c784510641a6779b05157fa22bcaeff5c620b 100644 (file)
--- a/ctlmod.py
+++ b/ctlmod.py
@@ -12,11 +12,14 @@ def modhas(modname, attname): return getattr(modules[modname], attname, None) is
 
 def load(parent, modname):
        if not isloaded(modname):
+               sys.path.insert(0, 'modules')
                try:
                        mod = __import__(modname)
                        reload(mod) #in case it's been previously loaded.
                except BaseException as e: #we don't want even sys.exit() to crash us (in case of malicious module) so use BaseException
                        return modlib.error(e)
+               finally:
+                       del sys.path[0] #remove ./modules from path, in case there's a name conflict
                        
 
                if not hasattr(mod, 'modinfo'):