Python3 requires to open explicitly on binary mode to write bytes

This commit is contained in:
Santiago L 2021-03-30 17:46:42 +02:00
parent fa8a895299
commit e7aabf4799
1 changed files with 13 additions and 13 deletions

View File

@ -174,7 +174,7 @@ def save_response_on_error(test):
timestamp = datetime.datetime.now().isoformat().replace(':', '') timestamp = datetime.datetime.now().isoformat().replace(':', '')
filename = '%s_%s.html' % (self.id(), timestamp) filename = '%s_%s.html' % (self.id(), timestamp)
path = '/home/orchestra/snapshots' path = '/home/orchestra/snapshots'
with open(os.path.join(path, filename), 'w') as dumpfile: with open(os.path.join(path, filename), 'wb') as dumpfile:
dumpfile.write(self.rest.last_response.content) dumpfile.write(self.rest.last_response.content)
raise raise
return inner return inner