Jython syntax error for the word "finally"

Here is the snippet that causes the error:

net.grinder.scriptengine.jython.JythonScriptExecutionException: SyntaxError: ('invalid syntax', ('C:\\grinder-3.7.1\\lib \\.\\nb-romg-file-store\\current\\grinder_test.py', 131, 9, ' finally:')) 


  ss = '' self._suggestionLock.acquire() try: ss = suggestion_strings.next() except StopIteration: suggestion_strings = suggestions_generator() ss = suggestion_strings.next() finally: self._suggestionLock.release() 

What could be wrong here?

+4
source share
2 answers

Are you using Jython 2.4? try / except / was finally introduced in Python 2.5.

+5
source

Jython only supports Python 2.4; try ... except ... finally was added in 2.5.

+1
source

Source: https://habr.com/ru/post/1401184/


All Articles