From 51d8e955577eda8efb1c20f723255ddc77401838 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 17 Aug 2022 18:36:36 +0530 Subject: [PATCH] workaround decode failure --- src/calibre/devices/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/devices/__init__.py b/src/calibre/devices/__init__.py index f958b4684f..bf5db6eb5a 100644 --- a/src/calibre/devices/__init__.py +++ b/src/calibre/devices/__init__.py @@ -114,7 +114,11 @@ 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().decode('utf-8', 'replace') + iro = Device.run_ioreg() + try: + ioreg += iro.decode('utf-8', 'replace') + except UnicodeDecodeError: + ioreg += repr(iro) connected_devices = [] if disabled_plugins: out('\nDisabled plugins:', textwrap.fill(' '.join([x.__class__.__name__ for x in