Bug 1786373

Summary: Wireless Device connection error: TypeError: can't concat str to bytes
Product: [Fedora] Fedora Reporter: Thomas Lake <tom+f>
Component: calibreAssignee: Kevin Fenzi <kevin>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 31CC: aimylios, chkr, helio, kevin, nushio, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: calibre-4.12.0-1.fc31 calibre-4.12.0-1.fc32 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-15 13:42:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Example fix none

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.