Control: tags -1 +patch
[Raphaël Hertzog]
> It looks like that the package was not fully tested in a Python 3 context
> as this is a common failure when you mix binary content and text
> content.
Thank you for bringing this to my attention. Definitely insufficient
testing. I had a look at the code and tried various approaches (use
decode(), decode('utf-8') to convert line, add encoding='utf-8' to
open), but in the end decided that no charset conversion magic is really
needed to find three ascii characters in a byte stream and went with
this approach below. Further testing also exposed other issues, also
fixed below.
diff --git a/isenkramd b/isenkramd
index ab09c9e..aea1fa9 100755
--- a/isenkramd
+++ b/isenkramd
@@ -286,7 +286,7 @@ npkgs = None
def notify_pleaseinstall(notification=None, action=None, data=None):
pkgs = data
- pkgsstr = string.join(pkgs, " ")
+ pkgsstr = " ".join(pkgs)
# print pkgs
print("info: button clicked, installing %s" % pkgsstr)
if use_apt_daemon:
@@ -295,7 +295,7 @@ def notify_pleaseinstall(notification=None, action=None,
data=None):
installer = PackageKitInstaller(pkgs)
installer.request_installation()
def notify(bus, vendor, device, pkgs):
- pkgstr = string.join(pkgs, " ")
+ pkgstr = " ".join(pkgs)
if 'usb' == bus:
usbdb = isenkram.usb.usbdb()
usbinfo = usbdb.product(vendor, device)
@@ -337,7 +337,7 @@ def is_pkg_installed(packagename):
while True:
retcode = p.poll()
line = p.stdout.readline()
- if 0 == line.find("ii "):
+ if 0 == line.find(b"ii "):
retval = True
if(retcode is not None):
break
@@ -402,7 +402,7 @@ def uevent_callback(client, action, device, user_data):
else:
alreadyinstalled.append(pkg)
print("info: not proposing already installed package(s) %s" % \
- string.join(alreadyinstalled, ', '))
+ ', '.join(alreadyinstalled))
if 0 < len(newpkg):
vendorid, deviceid, bcdevice = \
device.get_property("PRODUCT").split("/")
Please test it and let me know if it solve your problem too.
--
Happy hacking
Petter Reinholdtsen