Oct-29-2019, 12:05 PM
Hi,
We are trying to use Jython with Redis script within confluence using a Jython macro.
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.
Our execution piece of code for reference:
Please let us know if any thing is not clear or need more information to give a solution to this problem.
We are trying to use Jython with Redis script within confluence using a Jython macro.
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.
Quote: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, ‘’))
Our execution piece of code for reference:
Quote: try {
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.setOut(out);
interpreter.setErr(err);
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.