Adding the following System.out.println() line to CodeCompiler.java Index: C:/workspace/jython_svn/jython/src/org/python/compiler/CodeCompiler.java =================================================================== --- C:/workspace/jython_svn/jython/src/org/python/compiler/CodeCompiler.java (revision 3248) +++ C:/workspace/jython_svn/jython/src/org/python/compiler/CodeCompiler.java (working copy) @@ -859,6 +859,7 @@ } makeStrings(code, names, names.length); + System.out.println("thread="+Thread.currentThread()+", mod="+node.module +", names="+names[0]); loadFrame(); if (mrefs.importFrom == 0) { mrefs.importFrom = code.pool.Methodref( and changing the catch clause in Test.java to: } catch (Throwable t) { failures++; Throwable debug = new Throwable("error in thread ="+Thread.currentThread(), t); debug.printStackTrace(w); //w.println(t); w.flush(); } produces the following output line (among many other correct ones): thread=Thread[Thread-7,10,main], mod=sys.util, names=List while the import error later, on the same thread, is: java.lang.Throwable: error in thread =Thread[Thread-7,10,main] at threadtest.Test$1.run(Test.java:81) Caused by: Traceback (innermost last): File "", line 18, in ? ImportError: 3 no module named util at org.python.core.Py.ImportError(Py.java:228) at org.python.core.imp.import_logic(imp.java:614) at org.python.core.imp.import_name(imp.java:669) at org.python.core.imp.importName(imp.java:700) at org.python.core.ImportFunction.load(__builtin__.java:1171) at org.python.core.ImportFunction.__call__(__builtin__.java:1167) at org.python.core.PyObject.__call__(PyObject.java:476) at org.python.core.__builtin__.__import__(__builtin__.java:1143) at org.python.core.imp.importFromAs(imp.java:755) at org.python.core.imp.importFrom(imp.java:737) at org.python.pycode._pyx15.f$0(:18) at org.python.pycode._pyx15.call_function() at org.python.core.PyTableCode.call(PyTableCode.java:217) at org.python.core.PyCode.call(PyCode.java:14) at org.python.core.Py.runCode(Py.java:1225) at org.python.core.Py.exec(Py.java:1251) at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:135) at threadtest.Test$1.run(Test.java:78) Failures: 1 I'm not 100% sure that every ImporError has a corresponding output line. And we should keep in mind that there are NameErrors, too.