Index: src/org/python/core/packagecache/PathPackageManager.java =================================================================== --- src/org/python/core/packagecache/PathPackageManager.java (revision 7173) +++ src/org/python/core/packagecache/PathPackageManager.java (working copy) @@ -7,7 +7,9 @@ import org.python.core.Py; import org.python.core.PyJavaPackage; import org.python.core.PyList; +import org.python.core.PyObject; import org.python.core.PyString; +import org.python.core.PyUnicode; import org.python.core.util.RelativeFile; import java.io.BufferedInputStream; @@ -38,7 +40,11 @@ + name; for (int i = 0; i < path.__len__(); i++) { - String dir = path.pyget(i).__str__().toString(); + PyObject entry = path.pyget(i); + if (!(entry instanceof PyUnicode)) { + entry = entry.__str__(); + } + String dir = entry.toString(); File f = new RelativeFile(dir, child); try { @@ -96,7 +102,12 @@ String child = jpkg.__name__.replace('.', File.separatorChar); for (int i = 0; i < path.__len__(); i++) { - String dir = path.pyget(i).__str__().toString(); + PyObject entry = path.pyget(i); + if (!(entry instanceof PyUnicode)) { + entry = entry.__str__(); + } + String dir = entry.toString(); + if (dir.length() == 0) { dir = null; } Index: src/org/python/core/imp.java =================================================================== --- src/org/python/core/imp.java (revision 7173) +++ src/org/python/core/imp.java (working copy) @@ -436,7 +436,6 @@ } static PyObject find_module(String name, String moduleName, PyList path) { - PyObject loader = Py.None; PySystemState sys = Py.getSystemState(); PyObject metaPath = sys.meta_path; @@ -468,7 +467,10 @@ return loadFromLoader(loader, moduleName); } } - ret = loadFromSource(sys, name, moduleName, p.__str__().toString()); + if (!(p instanceof PyUnicode)) { + p = p.__str__(); + } + ret = loadFromSource(sys, name, moduleName, p.toString()); if (ret != null) { return ret; } Index: src/org/python/core/SyspathJavaLoader.java =================================================================== --- src/org/python/core/SyspathJavaLoader.java (revision 7173) +++ src/org/python/core/SyspathJavaLoader.java (working copy) @@ -115,7 +115,10 @@ SyspathArchive archive = (SyspathArchive)entry; buffer = getBytesFromArchive(archive, name); } else { - String dir = entry.__str__().toString(); + if (!(entry instanceof PyUnicode)) { + entry = entry.__str__(); + } + String dir = entry.toString(); buffer = getBytesFromDir(dir, name); } if (buffer != null) { @@ -155,7 +158,10 @@ } continue; } - String dir = sys.getPath(entry.__str__().toString()); + if (!(entry instanceof PyUnicode)) { + entry = entry.__str__(); + } + String dir = sys.getPath(entry.toString()); try { File resource = new File(dir, res); if (!resource.exists()) {