Univention Bugzilla – Bug 27848
Python 2.6 Fehlermeldung
Last modified: 2012-07-20 15:24:13 CEST
Trigger für python-support werden verarbeitet ... Compiling /usr/lib/pymodules/python2.4/univention/lib/share_restrictions.py ... File "/usr/lib/pymodules/python2.4/univention/lib/share_restrictions.py", line 187 with file("/etc/cups/printers.conf") as fd: ^ SyntaxError: invalid syntax /usr/lib/pymodules/python2.5/univention/lib/share_restrictions.py:187: Warning: 'with' will become a reserved keyword in Python 2.6 Compiling /usr/lib/pymodules/python2.5/univention/lib/share_restrictions.py ... File "/usr/lib/pymodules/python2.5/univention/lib/share_restrictions.py", line 187 with file("/etc/cups/printers.conf") as fd: ^ SyntaxError: invalid syntax Der Python2.6 spezifische Code sollte entfernt werden.
Das betrifft nur einzelne Pakete (univention-lib, python-univention), die ggf. schon vorab über das preup-Skript bei einem Update installiert werden.
Auch im UDM durch errata48: /usr/lib/pymodules/python2.5/univention/admin/uldap.py:257: Warning: 'as' will become a reserved keyword in Python 2.6 Compiling /usr/lib/pymodules/python2.5/univention/admin/uldap.py ... File "/usr/lib/pymodules/python2.5/univention/admin/uldap.py", line 257 except TypeError as e: ^ SyntaxError: invalid syntax
(In reply to comment #2) > Auch im UDM durch errata48: > > /usr/lib/pymodules/python2.5/univention/admin/uldap.py:257: Warning: 'as' will > become a reserved keyword in Python 2.6 > Compiling /usr/lib/pymodules/python2.5/univention/admin/uldap.py ... > File "/usr/lib/pymodules/python2.5/univention/admin/uldap.py", line 257 > except TypeError as e: > ^ > SyntaxError: invalid syntax →
(In reply to comment #2) > Auch im UDM durch errata48: > > /usr/lib/pymodules/python2.5/univention/admin/uldap.py:257: Warning: 'as' will > become a reserved keyword in Python 2.6 > Compiling /usr/lib/pymodules/python2.5/univention/admin/uldap.py ... > File "/usr/lib/pymodules/python2.5/univention/admin/uldap.py", line 257 > except TypeError as e: > ^ > SyntaxError: invalid syntax → Das wurde bereits in revision 33575 angepasst.
Der python2.6 spezifische code wurde durch 2.4 validen code ersetzt. Macht es in diesem Fall nicht Sinn, dieses script aus dem univention-lib Ordner rauszuwerfen und in univention-samba einzufügen? Momentan wird das Script nur in univention-lib reinkopiert ist aber kein Bestandteil von univention-lib. univention-samba (6.0.41-2) unstable; urgency=low . * backport to python2.4 valid code in share_restrictions.py (Bug #27848)
Bitte noch einmal überprüfen: try: fd = file(...) ... finally: fd.close() Wenn während open() schon eine Excpetion auftritt, kann close() nicht aufgerufen werden, daher ist es besser folgendes zu verwenden: fd = file(...) try: ... finally: fd.close() Damit wird die Datei geschlossen, wenn Exception in dem Try-Block auftreten.
Änderungen gemacht. univention-samba (6.0.44-1) unstable; urgency=low * try/finally fixes (Bug #27848)
Code sieht jetzt gut aus. Changelog passt, Verified.
UCS 3.0-2 has been released: http://forum.univention.de/viewtopic.php?f=54&t=1905 If this error occurs again, please use "Clone This Bug".