Search code examples
pythonexceptionjythongrinder

Jython syntax error on 'finally' word


Here's a snippet which causes an 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 may be wrong here?


Solution

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