We are trying to use Jython with Redis script within confluence using a Jython macro Which is one of Confluence Macro of Scripting for Confluence.
We are able to execute the action using Jython from the command line and able to read the variable from redis database and get the result, but when we try to use the PythonInterpreter class from within Java application we get the below error. It would be great can suggest ,how to handle this error.
Traceback (most recent call last): line 4, in File “/opt/jython/Lib/site-packages/redis/ init .py”, line 1, in from redis.client import Redis, StrictRedis SyntaxError: (“no viable alternative at input ‘’’‘“, (‘/opt/jython/Lib/site-packages/redis/client.py’, 28, 13, ‘’))
We were able to reproduce exact the issue through command line, but not through Interpreter.
try {
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.setOut(out);
interpreter.setErr(err);
setVariable(interpreter, variableNames, "out", stdout);
setVariable(interpreter, variableNames, "err", stderr);
setVariables(interpreter, variableNames, info);
setParameterVariables(interpreter, variableNames, info);
interpreter.exec(code);
} catch (PyException exception) { // Exception from parsing script
errorText = getModifiedErrorText(exception.toString());
errorTitle = errorText.startsWith("SyntaxError") ? "Syntax error" : "Error running script";
} catch (Exception exception) { // Some other exception from the script
errorTitle = "Unexpected error running script";
errorText = exception.toString();
}
Please let us know if any thing is not clear or need more information to give a solution to this problem.