Don't raise errors if log file is missing

master
Dan Howe 6 years ago
parent dd749ca0d9
commit 793ca0ade4

@ -229,17 +229,20 @@ def telemetered_bore_downloader(bore_ids, start_date, end_date, download_dir):
# Stop logging # Stop logging
logging.shutdown() logging.shutdown()
with open(log_name, 'r') as f:
log_data = f.read()
# Check contents of log file
if log_data:
warnings.warn(
'Some files failed to download. See log for details.',
stacklevel=2)
else:
os.remove(log_name)
if os.path.isfile(log_name)
with open(log_name, 'r') as f:
log_data = f.read()
# Check contents of log file
if log_data:
warnings.warn(
'Some files failed to download. See log for details.',
stacklevel=2)
else:
os.remove(log_name)
# Close browser
driver.quit() driver.quit()

Loading…
Cancel
Save