Hotfix remove temp file if exists when running upload_to_ckan command.
FAILURE -- archive_data
Name: sensorsafrica.tasks.archive_data
Execution time: 1 minutes 46 seconds
Task ID: 0e7f794b-f13d-41f8-8636-ea1c60520731
args: []
kwargs: {}
Exception: [Errno 2] No such file or directory: '/tmp/january_2020_sensor_data_archive.csv'
Info:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/celery/app/trace.py", line 382, in trace_task
R = retval = fun(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/celery/app/trace.py", line 641, in __protected_call__
return self.run(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/sentry_sdk/integrations/celery.py", line 66, in _inner
reraise(*_capture_exception())
File "/usr/local/lib/python3.6/site-packages/sentry_sdk/_compat.py", line 44, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/sentry_sdk/integrations/celery.py", line 64, in _inner
return f(*args, **kwargs)
File "/src/sensorsafrica/tasks.py", line 12, in archive_data
call_command("upload_to_ckan")
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 131, in call_command
return command.execute(*args, **defaults)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/src/sensorsafrica/management/commands/upload_to_ckan.py", line 106, in handle
os.remove(filepath)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/january_2020_sensor_data_archive.csv'