Bug 1786373 - Wireless Device connection error: TypeError: can't concat str to bytes
Summary: Wireless Device connection error: TypeError: can't concat str to bytes
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: calibre
Version: 31
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Kevin Fenzi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-12-24 19:08 UTC by Thomas Lake
Modified: 2020-03-16 20:35 UTC (History)
6 users (show)

Fixed In Version: calibre-4.12.0-1.fc31 calibre-4.12.0-1.fc32
Doc Type: ---
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-15 13:42:20 UTC
Type: Bug


Attachments (Terms of Use)
Example fix (659 bytes, patch)
2019-12-24 19:08 UTC, Thomas Lake
no flags Details | Diff

Description Thomas Lake 2019-12-24 19:08:37 UTC
Created attachment 1647536 [details]
Example fix

Description of problem:
Calibre companion app cannot connect - Python TypeError in smart device driver.


Version-Release number of selected component (if applicable): 4.6.0-1.fc31


How reproducible:
1. Start wireless device server
2. Connect device


Actual results:
Device disconnects without error displayed in either GUI or device.
Traceback visible if calibre launched from terminal.

Traceback (most recent call last):
  File "/usr/lib64/calibre/calibre/devices/smart_device_app/driver.py", line 638, in _call_client
    self._send_byte_string(self.device_socket, (b'%d' % len(s)) + s)
TypeError: can't concat str to bytes
Traceback (most recent call last):
  File "/usr/lib64/calibre/calibre/gui2/device.py", line 298, in detect_device
    dev.open(cd, self.current_library_uuid)
  File "/usr/lib64/calibre/calibre/devices/smart_device_app/driver.py", line 49, in _synchronizer
    return func(self, *args, **kwargs)
  File "/usr/lib64/calibre/calibre/devices/smart_device_app/driver.py", line 1050, in open
    'canSupportLpathChanges': True})
  File "/usr/lib64/calibre/calibre/devices/smart_device_app/driver.py", line 49, in _synchronizer
    return func(self, *args, **kwargs)
  File "/usr/lib64/calibre/calibre/devices/smart_device_app/driver.py", line 638, in _call_client
    self._send_byte_string(self.device_socket, (b'%d' % len(s)) + s)
TypeError: can't concat str to bytes


Expected results:
Device connects and syncs to Calibre.

Additional info:

Explicitly encoding string to UTF-8 works - patch attached.
Not sure whether there is a better option for fixing this, but it got my device  synchronising again.

Comment 1 Thomas Lake 2019-12-24 19:15:34 UTC
Also present in calibre-4.5.0-1

Comment 2 Marcus 2020-03-01 11:34:44 UTC
A fix for this has been merged upstream a couple of days ago and will be part of version 4.12.0.
https://github.com/kovidgoyal/calibre/commits/master/src/calibre/devices/smart_device_app

Comment 3 Fedora Update System 2020-03-07 02:07:21 UTC
FEDORA-2020-65a5d0462d has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-65a5d0462d

Comment 4 Fedora Update System 2020-03-07 17:17:06 UTC
calibre-4.12.0-1.fc32 has been pushed to the Fedora 32 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-df465db1c1

Comment 5 Fedora Update System 2020-03-08 01:37:19 UTC
calibre-4.12.0-1.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-65a5d0462d

Comment 6 Fedora Update System 2020-03-15 13:42:20 UTC
calibre-4.12.0-1.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2020-03-16 20:35:07 UTC
calibre-4.12.0-1.fc32 has been pushed to the Fedora 32 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.