From: Wesley S. <re...@bu...> - 2008-08-26 10:01:17
|
New submission from Wesley Schwengle <we...@sl...>: Code: def load_modules(dir, module_prefix = None): files = os.listdir(dir) files.sort() for filename in files: if not filename.endswith('.py') or not filename[0:1].isupper(): continue file = filename[:-3] if module_prefix == None: mod = __import__(file, fromlist=filename) else: mod = __import__('%s.%s' % (module_prefix, file), fromlist=filename) c = getattr(mod, file) o = c() info(o) // prints information about the module/class path = "/home/wesleys/sbox/blpython/src/lib/OSS/bladelogic" load_modules(path, "OSS.bladelogic") Running this code in python (2.5.1) works as expected, with jython it fails.. 2.2.1: Traceback (innermost last): File "test_logic.py", line 48, in ? File "test_logic.py", line 38, in load_modules TypeError: __import__() takes no keyword arguments 2.5a1: Traceback (most recent call last): File "test_logic.py", line 48, in <module> load_modules(path, "OSS.bladelogic") File "test_logic.py", line 38, in load_modules mod = __import__('%s.%s' % (module_prefix, file), fromlist=filename) TypeError: __import__() takes no keyword arguments ---------- components: Any messages: 3449 nosy: wesleys severity: normal status: open title: __import__() not working in 2.2.1 versions: 2.2.2 _______________________________________ Jython tracker <re...@bu...> <http://bugs.jython.org/issue1111> _______________________________________ |