bugfixes: error solving for unwritable files

master
TiynGER 4 years ago
parent 9d08df462b
commit b7b4683e0b

@ -143,11 +143,14 @@ class Studip:
#total_size = int(rsp2.headers.get('content-length', 0))
log.info('downloading ' + doc_name)
#progbar = tqdm(total=total_size, unit='iB', unit_scale=True)
with open(doc_name, 'wb') as doc_file:
for chunk in rsp2.iter_content(self.CHUNK_SIZE):
#progbar.update(len(chunk))
doc_file.write(chunk)
self.db.set_last_file_dl(str(doc), str(int(time.time())))
try:
with open(doc_name, 'wb') as doc_file:
for chunk in rsp2.iter_content(self.CHUNK_SIZE):
#progbar.update(len(chunk))
doc_file.write(chunk)
self.db.set_last_file_dl(str(doc), str(int(time.time())))
except:
log.CRITICAL("Error while writing to the file " + doc_name)
def get_subdirs(self, folder):
"""Get all the subdirectories of a given folder.

Loading…
Cancel
Save