Index: src/org/python/core/StdoutWrapper.java =================================================================== --- src/org/python/core/StdoutWrapper.java (revision 3550) +++ src/org/python/core/StdoutWrapper.java (working copy) @@ -95,10 +95,11 @@ } public void print(PyObject o, boolean space, boolean newline) { - PyString string = o.__str__(); + PyString string = null; PyObject obj = myFile(); if (obj instanceof PyFile) { + string = o.__str__(); PyFile file = (PyFile) obj; String s = string.toString(); if (newline) { @@ -114,6 +115,11 @@ } file.softspace = space; } else { + try { + string = o.__str__(); + } catch (Throwable t) { + string = (PyString)o; + } PyObject ss = obj.__findattr__("softspace"); if (ss != null && ss.__nonzero__()) { obj.invoke("write", Py.Space);