Univention Bugzilla – Bug 52018
Execute UCR with Python 3
Last modified: 2021-12-10 08:10:05 CET
The UCR scripts should run with Python 3.
This depends on the appcenter and the updater being compatble to Python 3 (at least in the parts which are used in the UCR templates).
https://jenkins.knut.univention.de:8181/job/UCS-5.0/job/UCS-5.0-0/job/Tests%20-%20AD%20Connector%20(ec2)/Version=w2k8r2-german/2/console 12:08:40 File "/usr/lib/python3/dist-packages/six.py", line 692, in reraise 12:08:40 raise value.with_traceback(tb) 12:08:40 File "/usr/lib/python3/dist-packages/univention/management/console/protocol/modserver.py", line 307, in handle 12:08:40 self.__handler.init() 12:08:40 File "/usr/lib/python3/dist-packages/univention/management/console/modules/adconnector/__init__.py", line 155, in init 12:08:40 self.__update_status() 12:08:40 File "/usr/lib/python3/dist-packages/univention/management/console/modules/adconnector/__init__.py", line 360, in __update_status 12:08:40 ucr.load() 12:08:40 File "/usr/lib/python3/dist-packages/univention/config_registry/backend.py", line 143, in load 12:08:40 reg.load() 12:08:40 File "/usr/lib/python3/dist-packages/univention/config_registry/backend.py", line 536, in load 12:08:40 for line in reg_file: 12:08:40 File "/usr/lib/python3.7/encodings/ascii.py", line 26, in decode 12:08:40 return codecs.ascii_decode(input, self.errors)[0] 12:08:40 UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4977: ordinal not in range(128)
(In reply to Florian Best from comment #3) This was caused by a process without a set locale, e.g. because environment variables are cleared. Fixed in: univention-config-registry (15.0.4-1) 40081d083f25 | fixup! Bug #52018: open files with UTF-8 encoding 4925a79a2009 | Bug #52018: open files with UTF-8 encoding All scripts are migrated in: univention-config-registry (15.0.4-1) 88af724e8066 | Bug #52018 UCR: Use contextmanager for open() 66bba75ce065 | Bug #52018 UCR: Fix DeprecationWarning: collections.MutableMapping 5b10065557ce | Bug #52018 UCR: python3 compatibility fixes changelog-5.0-0.xml b7fb9c2c78d7 | Changelog Bug #52157 Bug #52018
The last thing which had to be done was that run_filter() returny binary output - aka. what the python subprocesses print. This might be binary output in case of e.g. '/etc/univention/templates/files/usr/share/univention-management-console/i18n/de/apps.mo'. univention-config-registry (15.0.4-1) 28cc2e6896da | Bug #52018: allow UCR templates to print binary output in run_filter()
I have reviewd the code and also test build and update of ucr packages and tested that ucr still works as before.
UCS 5.0 has been released: https://docs.software-univention.de/release-notes-5.0-0-en.html https://docs.software-univention.de/release-notes-5.0-0-de.html If this error occurs again, please use "Clone This Bug".