mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Avoid error on python3 about str and bytes
When I launch the calibre application build for python3 I get two errors about expecting bytes not str and the other way around. in src/calibre/devices/mtp/driver.py and src/calibre/devices/mtp/unix/driver.py I found that theses edits remove the error.
This commit is contained in:
parent
62d38e6706
commit
c68bb58ffa
@ -396,12 +396,11 @@ class MTP_DEVICE(MTPDeviceBase):
|
|||||||
raise ValueError('Cannot upload file %s, it already exists'%(
|
raise ValueError('Cannot upload file %s, it already exists'%(
|
||||||
e.full_path,))
|
e.full_path,))
|
||||||
self.delete_file_or_folder(e)
|
self.delete_file_or_folder(e)
|
||||||
ename = name.encode('utf-8') if isinstance(name, unicode_type) else name
|
|
||||||
sid, pid = parent.storage_id, parent.object_id
|
sid, pid = parent.storage_id, parent.object_id
|
||||||
if pid == sid:
|
if pid == sid:
|
||||||
pid = 0xFFFFFFFF
|
pid = 0xFFFFFFFF
|
||||||
|
|
||||||
ans, errs = self.dev.put_file(sid, pid, ename, stream, size, callback)
|
ans, errs = self.dev.put_file(sid, pid, name, stream, size, callback)
|
||||||
if ans is None:
|
if ans is None:
|
||||||
raise DeviceError('Failed to upload file named: %s to %s: %s'
|
raise DeviceError('Failed to upload file named: %s to %s: %s'
|
||||||
%(name, parent.full_path, self.format_errorstack(errs)))
|
%(name, parent.full_path, self.format_errorstack(errs)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user