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)) #total_size = int(rsp2.headers.get('content-length', 0))
log.info('downloading ' + doc_name) log.info('downloading ' + doc_name)
#progbar = tqdm(total=total_size, unit='iB', unit_scale=True) #progbar = tqdm(total=total_size, unit='iB', unit_scale=True)
with open(doc_name, 'wb') as doc_file: try:
for chunk in rsp2.iter_content(self.CHUNK_SIZE): with open(doc_name, 'wb') as doc_file:
#progbar.update(len(chunk)) for chunk in rsp2.iter_content(self.CHUNK_SIZE):
doc_file.write(chunk) #progbar.update(len(chunk))
self.db.set_last_file_dl(str(doc), str(int(time.time()))) 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): def get_subdirs(self, folder):
"""Get all the subdirectories of a given folder. """Get all the subdirectories of a given folder.

Loading…
Cancel
Save