[zeppelin-1555] Eliminate prefix in PythonInterpreter exception

This commit is contained in:
Kai Jiang 2016-10-16 17:54:11 -07:00 committed by GitHub
parent 465c51a419
commit d7a2ef4003
2 changed files with 4 additions and 11 deletions

View file

@ -68,7 +68,7 @@ public class PythonInterpreter extends Interpreter {
@Override
public void open() {
LOG.info("Starting Python interpreter .....");
LOG.info("Starting Python interpreter ---->");
LOG.info("Python path is set to:" + property.getProperty(ZEPPELIN_PYTHON));
maxResult = Integer.valueOf(getProperty(MAX_RESULT));
@ -111,7 +111,7 @@ public class PythonInterpreter extends Interpreter {
@Override
public void close() {
LOG.info("closing Python interpreter .....");
LOG.info("closing Python interpreter <----");
try {
if (process != null) {
process.close();
@ -134,11 +134,9 @@ public class PythonInterpreter extends Interpreter {
InterpreterResult result;
if (pythonErrorIn(output)) {
result = new InterpreterResult(Code.ERROR, output);
result = new InterpreterResult(Code.ERROR, output.replaceAll("\\.\\.\\.", ""));
} else {
// TODO(zjffdu), we should not do string replacement operation in the result, as it is
// possible that the output contains the kind of pattern itself, e.g. print("...")
result = new InterpreterResult(Code.SUCCESS, output.replaceAll("\\.\\.\\.", ""));
result = new InterpreterResult(Code.SUCCESS, output);
}
return result;
}

View file

@ -91,11 +91,6 @@ public class PythonProcess {
String line = null;
while (!(line = reader.readLine()).contains(STATEMENT_END)) {
logger.debug("Read line from python shell : " + line);
if (line.equals("...")) {
logger.warn("Syntax error ! ");
output.append("Syntax error ! ");
break;
}
output.append(line + "\n");
}
return output.toString();