Created on 2019-10-24.08:05:11 by rkanumola, last changed 2019-10-29.12:49:41 by adamburke.
|msg12714 (view)||Author: RK (rkanumola)||Date: 2019-10-24.08:05:11|
Hi Team, 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. 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, ‘’)) Please let us know if any thing is not clear or need more information to give a solution to this problem.
|msg12716 (view)||Author: Adam Burke (adamburke)||Date: 2019-10-26.09:05:09|
Hi this is unlikely to be a Jython bug (you'd certainly need rather more evidence) - so the Jython bug tracker isn't the best place. jython-users@ or stackoverflow would be better. However, just to help you along, check the Jython versions being used in the different contexts - Java, confluence macro, and Jython from the command line. The specific error is a parsing error from the antlr library saying a particular syntax isn't supported. There is an example on SO of it happening when running a dictionary comprehension (supported on 2.7.x) under 2.5, where it wasn't supported: https://stackoverflow.com/questions/25200629/error-no-viable-alternative-at-input-for-python
|msg12724 (view)||Author: RK (rkanumola)||Date: 2019-10-29.12:06:56|
Hi Adam, Thanks for the response. We tried using 2.7 but that did not help. As we are using PythonInterpreter is this something related to Python software configuration ? Thanks RK
|msg12726 (view)||Author: Adam Burke (adamburke)||Date: 2019-10-29.12:49:40|
Hi RK, it's hard to say with the detail provided here. If exactly the same scripts runs ok in one context, with a particular Jython executable, but gives this error in another, it would usually point to inconsistent versions of the interpreter. Because it is complaining a particular piece of syntax isn't available. It is also possible with whitespace problems - but you said the literal same script runs fine from the command line. You may know this already, but to print the version of the Python interpreter (including for Jython) from within a script: import sys print(sys.version) Example output from my local machine: 2.7.2a1+ (, May 20 2019, 14:18:30) [OpenJDK 64-Bit Server VM (Oracle Corporation)]
|2019-10-29 12:49:41||adamburke||set||messages: + msg12726|
|2019-10-29 12:06:56||rkanumola||set||messages: + msg12724|
messages: + msg12716