Trent Mick wrote: > That is the current state. which reminds that maybe it's time to add an import helper to the standard library, so you can do stringio = import_search("cStringIO", "StringIO") ET = import_search("lxml.etree", "cElementTree", "xml.etree.cElementTree") db = import_search("superdb", "sqlite3", "fancydb", "dumbdb") etc. without having to type in for mod in ("cStringIO", "StringIO"): try: m = __import__(mod) for p in mod.split(".")[1:]: m = getattr(m, p, None) if m is None: raise ImportError return m except ImportError: pass else: raise ImportError(mod) all the time (or create those horridly nested try-except constructs). or perhaps try: import cStringIO as stringio retry ImportError: import StringIO as stringio except ImportError: print "didn't work!" would be a solution (sorry, wrong list). </F>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4