Fixed Python 3.2/3.3 compatibility

This commit is contained in:
Raphael Michel
2015-08-21 12:09:21 +02:00
parent 3b17434ebf
commit 6b341ed485
2 changed files with 12 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
import importlib.util
import sys
def module_exists(modname):
if sys.version_info[0:1] >= (3, 4):
return bool(importlib.util.find_spec(modname))
else:
return bool(importlib.find_loader(modname))