Merge pull request #7 from patrickdepinguin/py3fix

More python 3 related fixes
This commit is contained in:
Rodolfo García Peñas (kix) 2020-10-12 12:44:19 +02:00 committed by GitHub
commit d8149c1ec1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -459,8 +459,9 @@ class SyncableAccount(Account):
p = Popen(cmd, shell=True, p = Popen(cmd, shell=True,
stdin=PIPE, stdout=PIPE, stderr=PIPE, stdin=PIPE, stdout=PIPE, stderr=PIPE,
close_fds=True) close_fds=True)
r = p.communicate() stdout, stderr = p.communicate()
self.ui.callhook("Hook stdout: %s\nHook stderr:%s\n" % r) self.ui.callhook("Hook stdout: %s\nHook stderr:%s\n"
% (stdout.decode('utf-8'), stderr.decode('utf-8')))
self.ui.callhook("Hook return code: %d" % p.returncode) self.ui.callhook("Hook return code: %d" % p.returncode)
except (KeyboardInterrupt, SystemExit): except (KeyboardInterrupt, SystemExit):
raise raise

View File

@ -482,7 +482,8 @@ class IMAPFolder(BaseFolder):
item[1], flags=re.IGNORECASE): item[1], flags=re.IGNORECASE):
found = item[0] found = item[0]
elif found is not None: elif found is not None:
if type(item) == type(""): if type(item) == type(b""):
item = item.decode('utf-8')
uid = re.search("UID\s+(\d+)", item, flags=re.IGNORECASE) uid = re.search("UID\s+(\d+)", item, flags=re.IGNORECASE)
if uid: if uid:
return int(uid.group(1)) return int(uid.group(1))