Clarify messages when optional modules are not found.

This commit is contained in:
Joel Martin 2013-04-19 17:14:20 -05:00
parent 477947ba96
commit b7f255ce0b
1 changed files with 5 additions and 5 deletions

View File

@ -50,15 +50,15 @@ except:
return struct.unpack(fmt, slice) return struct.unpack(fmt, slice)
# Degraded functionality if these imports are missing # Degraded functionality if these imports are missing
for mod, sup in [('numpy', 'HyBi protocol'), ('ssl', 'TLS/SSL/wss'), for mod, msg in [('numpy', 'HyBi protocol will be slower'),
('multiprocessing', 'Multi-Processing'), ('ssl', 'TLS/SSL/wss is disabled'),
('resource', 'daemonizing')]: ('multiprocessing', 'Multi-Processing is disabled'),
('resource', 'daemonizing is disabled')]:
try: try:
globals()[mod] = __import__(mod) globals()[mod] = __import__(mod)
except ImportError: except ImportError:
globals()[mod] = None globals()[mod] = None
print("WARNING: no '%s' module, %s is slower or disabled" % ( print("WARNING: no '%s' module, %s" % (mod, msg))
mod, sup))
if multiprocessing and sys.platform == 'win32': if multiprocessing and sys.platform == 'win32':
# make sockets pickle-able/inheritable # make sockets pickle-able/inheritable
import multiprocessing.reduction import multiprocessing.reduction