Reputation: 2418
I developed a project using python. Now i need a gui for that project. So i choose jython for gui(java swing). I also integrate theme in one code (existing project + gui(jython) code). When i run the file with the following command then it shows a syntax error
jython project.py
Error:
File "project.py", line 33
SyntaxError: 'with' will become a reserved keyword in Python 2.6
Line#33:
32 def _finished_loading(self, view, frame):
33 with open(self._file, 'w') as f:
When i run the existing project with python command then it runs ok. That means there is no problem with the project. And i assure you that gui(jython) code and integration are also fine.
Upvotes: 6
Views: 4714
Reputation: 21279
Because with
only just appeared in 2.5, you need a from __future__
import:
from __future__ import with_statement
Then you can use your with
statement. It won't solve your other problems that cropped up in your comments, though...
Upvotes: 10