1from __future__ import print_function, unicode_literals 2 3import platform 4import sys 5 6 7info = { 8 "impl": platform.python_implementation(), 9 "version": platform.python_version(), 10 "revision": platform.python_revision(), 11 "maxunicode": sys.maxunicode, 12 "maxsize": sys.maxsize 13} 14 15search_modules = ["charade", "chardet", "datrie", "genshi", "html5lib", "lxml", "six"] 16found_modules = [] 17 18for m in search_modules: 19 try: 20 __import__(m) 21 except ImportError: 22 pass 23 else: 24 found_modules.append(m) 25 26info["modules"] = ", ".join(found_modules) 27 28 29print("""html5lib debug info: 30 31Python %(version)s (revision: %(revision)s) 32Implementation: %(impl)s 33 34sys.maxunicode: %(maxunicode)X 35sys.maxsize: %(maxsize)X 36 37Installed modules: %(modules)s""" % info) 38