sponsor-patch: fix bugs from py3 migration

This commit is contained in:
Logan Rosen 2021-02-22 22:24:52 -05:00
parent a75fb35fc8
commit bc24ef23de
3 changed files with 3 additions and 3 deletions

View File

@ -82,7 +82,7 @@ def input_number(question, min_number, max_number, default=None):
else: else:
question += "? " question += "? "
selected = None selected = None
while selected < min_number or selected > max_number: while not selected or selected < min_number or selected > max_number:
try: try:
selected = input(question).strip() selected = input(question).strip()
except (EOFError, KeyboardInterrupt): except (EOFError, KeyboardInterrupt):

View File

@ -74,7 +74,7 @@ class BugTask(object):
if url.endswith(".dsc"): if url.endswith(".dsc"):
response, data = httplib2.Http().request(url) response, data = httplib2.Http().request(url)
assert response.status == 200 assert response.status == 200
with open(filename, 'w') as f: with open(filename, 'wb') as f:
f.write(data) f.write(data)
dsc_file = os.path.join(os.getcwd(), filename) dsc_file = os.path.join(os.getcwd(), filename)

View File

@ -68,7 +68,7 @@ class Patch(object):
def download(self): def download(self):
"""Downloads the patch from Launchpad.""" """Downloads the patch from Launchpad."""
Logger.debug("Downloading %s." % (self._patch_file)) Logger.debug("Downloading %s." % (self._patch_file))
patch_f = open(self._patch_file, "w") patch_f = open(self._patch_file, "wb")
patch_f.write(self._patch.data.open().read()) patch_f.write(self._patch.data.open().read())
patch_f.close() patch_f.close()