if (cause instanceof PySyntaxError) {
// set a clear syntax error message
PySyntaxError syntaxError = (PySyntaxError) cause;
try {
PyString fileName, text;
PyInteger lineNumber, columnNumber;
if (syntaxError.value instanceof PyTuple) {
PyObject[] infos = ((PyTuple) ((PyTuple) syntaxError.value).getArray()[1]).getArray();
fileName = (PyString) infos[0];
lineNumber = (PyInteger) infos[1];
columnNumber = (PyInteger) infos[2];
text = (PyString) infos[3];
} else {
fileName = (PyString) syntaxError.value.__getattr__(new PyString("filename"));
lineNumber = (PyInteger) syntaxError.value.__getattr__(new PyString("lineno"));
columnNumber = (PyInteger) syntaxError.value.__getattr__(new PyString("offset"));
text = (PyString) syntaxError.value.__getattr__(new PyString("text"));
message = "Python syntax error in file " + fileName + " at line " + lineNumber + ", column " + columnNumber + ":\n" + text;
}
message = "Python syntax error in file " + fileName + " at line " + lineNumber + ", column " + columnNumber + ":\n" + text;
result.addStackTraceElement(new StackTraceElement("", "", fileName.toString(), Integer.parseInt(lineNumber.toString())));
dumpStack = false;
} catch (PyException pye) {
message = "Python syntax error (Couldn't decode localization of error)";
}
} else if (cause instanceof PyException) {