From ea2b8922cc9474d75742647dbe6698ef08287c20 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 25 Sep 2020 14:10:54 +0530 Subject: [PATCH] macOS: Fix a regression that broke connecting to devices --- src/calibre/devices/__init__.py | 4 ++-- src/calibre/devices/usbobserver/usbobserver.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/__init__.py b/src/calibre/devices/__init__.py index cf25074d43..290b8dc6d2 100644 --- a/src/calibre/devices/__init__.py +++ b/src/calibre/devices/__init__.py @@ -114,7 +114,7 @@ def debug(ioreg_to_tmp=False, buf=None, plugins=None, drives = pprint.pformat(Device.osx_get_usb_drives()) ioreg = 'Output from mount:\n'+mount+'\n\n' ioreg += 'Output from osx_get_usb_drives:\n'+drives+'\n\n' - ioreg += Device.run_ioreg() + ioreg += Device.run_ioreg().decode('utf-8') connected_devices = [] if disabled_plugins: out('\nDisabled plugins:', textwrap.fill(' '.join([x.__class__.__name__ for x in @@ -180,7 +180,7 @@ def debug(ioreg_to_tmp=False, buf=None, plugins=None, ioreg = 'IOREG Output\n'+ioreg out(' ') if ioreg_to_tmp: - lopen('/tmp/ioreg.txt', 'wb').write(ioreg) + lopen('/tmp/ioreg.txt', 'w').write(ioreg) out('Dont forget to send the contents of /tmp/ioreg.txt') out('You can open it with the command: open /tmp/ioreg.txt') else: diff --git a/src/calibre/devices/usbobserver/usbobserver.c b/src/calibre/devices/usbobserver/usbobserver.c index 16bad28463..39c4d18a82 100644 --- a/src/calibre/devices/usbobserver/usbobserver.c +++ b/src/calibre/devices/usbobserver/usbobserver.c @@ -280,7 +280,7 @@ usbobserver_get_mounted_filesystems(PyObject *self, PyObject *args) { if (ans == NULL) { goto end; } for (i = 0 ; i < num; i++) { - val = PyBytes_FromString(buf[i].f_mntonname); + val = PyUnicode_FromString(buf[i].f_mntonname); if (!val) { NUKE(ans); goto end; } if (PyDict_SetItemString(ans, buf[i].f_mntfromname, val) != 0) { NUKE(ans); NUKE(val); goto end; } NUKE(val);