This is caused because the package relies upon using the Python "with" keyword. For Python 2.6 "with" is available by default but for Python 2.5 any script that uses "with" needs to do a future import as the first line of the script:
from __future__ import with_statement
Compiling the package manually shows the same error:
--- Python 2.5 ---
cd /usr/lib/python2.5/site-packages/Onboard/
sudo rm *.pyc
sudo python2.5
Python 2.5.4 (r254:67916, Jan 20 2010, 21:43:02)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import compileall
>>> compileall.compile_dir('./')
Listing ./ ...
Compiling ./Config.py ...
Compiling ./Exceptions.py ...
Compiling ./IconPalette.py ...
Compiling ./KbdWindow.py ...
Compiling ./KeyCommon.py ...
Compiling ./KeyGtk.py ...
Compiling ./Keyboard.py ...
Compiling ./KeyboardGTK.py ...
Compiling ./KeyboardSVG.py ...
./KeyboardSVG.py:105: Warning: 'with' will become a reserved keyword in Python 2.6
File "./KeyboardSVG.py", line 105
with open(pane_svg_filename) as svg_file:
^
SyntaxError: invalid syntax
This is caused because the package relies upon using the Python "with" keyword. For Python 2.6 "with" is available by default but for Python 2.5 any script that uses "with" needs to do a future import as the first line of the script:
from __future__ import with_statement
Compiling the package manually shows the same error:
--- Python 2.5 --- python2. 5/site- packages/ Onboard/ compile_ dir('./ ') py:105: Warning: 'with' will become a reserved keyword in Python 2.6 svg_filename) as svg_file:
cd /usr/lib/
sudo rm *.pyc
sudo python2.5
Python 2.5.4 (r254:67916, Jan 20 2010, 21:43:02)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import compileall
>>> compileall.
Listing ./ ...
Compiling ./Config.py ...
Compiling ./Exceptions.py ...
Compiling ./IconPalette.py ...
Compiling ./KbdWindow.py ...
Compiling ./KeyCommon.py ...
Compiling ./KeyGtk.py ...
Compiling ./Keyboard.py ...
Compiling ./KeyboardGTK.py ...
Compiling ./KeyboardSVG.py ...
./KeyboardSVG.
File "./KeyboardSVG.py", line 105
with open(pane_
^
SyntaxError: invalid syntax
Compiling ./OnboardGtk.py ...
Compiling ./Pane.py ...
Compiling ./SnippetList.py ...
Compiling ./__init__.py ...
Compiling ./settings.py ...
Compiling ./utils.py ...
0
>>> exit()
------
The attached patch adds the required line to KeyboardSVG.py. It is tested with python2.5 and python2.6 on Karmic and works for both:
--- Python 2.5 --- python2. 5/site- packages/ Onboard/ compile_ dir('./ ')
cd /usr/lib/
sudo rm *.pyc
sudo python2.5
Python 2.5.4 (r254:67916, Jan 20 2010, 21:43:02)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import compileall
>>> compileall.
Listing ./ ...
Compiling ./Config.py ...
Compiling ./Exceptions.py ...
Compiling ./IconPalette.py ...
Compiling ./KbdWindow.py ...
Compiling ./KeyCommon.py ...
Compiling ./KeyGtk.py ...
Compiling ./Keyboard.py ...
Compiling ./KeyboardGTK.py ...
Compiling ./KeyboardSVG.py ...
Compiling ./OnboardGtk.py ...
Compiling ./Pane.py ...
Compiling ./SnippetList.py ...
Compiling ./__init__.py ...
Compiling ./settings.py ...
Compiling ./utils.py ...
1
>>> exit()
------
--- Python 2.6 --- python2. 6/dist- packages/ Onboard/ compile_ dir('./ ')
cd /usr/lib/
sudo rm *.pyc
sudo python2.6
Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import compileall
>>> compileall.
Listing ./ ...
Compiling ./Config.py ...
Compiling ./Exceptions.py ...
Compiling ./IconPalette.py ...
Compiling ./KbdWindow.py ...
Compiling ./KeyCommon.py ...
Compiling ./KeyGtk.py ...
Compiling ./Keyboard.py ...
Compiling ./KeyboardGTK.py ...
Compiling ./KeyboardSVG.py ...
Compiling ./OnboardGtk.py ...
Compiling ./Pane.py ...
Compiling ./SnippetList.py ...
Compiling ./__init__.py ...
Compiling ./settings.py ...
Compiling ./utils.py ...
1
>>> exit()
------