"polaris fetch" errors with unhelpful message if there were no frames to download
The polaris fetch
command exits with this unhelpful traceback when there are no frames to download:
polaris fetch LightSail-2 /tmp/polaris_batch/lightsail2/cache/normalized_frames.json
2020-01-09 09:05:30,974 - polaris.fetch.data_fetch_decoder - INFO - Satellite: id=44420 name=LightSail-2 decoder=Lightsail2
2020-01-09 09:05:30,974 - polaris.fetch.data_fetch_decoder - INFO - selected decoder=Lightsail2
2020-01-09 09:05:30,974 - polaris.fetch.data_fetch_decoder - INFO - Fetch period: 2020-01-09 16:05:30.974456+00:00 to 2020-01-09 17:05:30.974456+00:00
Demoddata module(s) loading :
module : CSV loaded
job 1 scanning page...1
job 1 terminated
downloading started (Ctrl + C to stop)... ~( ^o^)~
2020-01-09 09:05:34,217 - polaris.fetch.data_fetch_decoder - INFO - Saving the dataframes in directory: /tmp
2020-01-09 09:05:34,218 - polaris.fetch.data_fetch_decoder - INFO - Merging all the csv files into one CSV file.
Traceback (most recent call last):
File "/dev/shm/polaris-clean/.venv/bin/polaris", line 11, in <module>
load_entry_point('polaris-ml', 'console_scripts', 'polaris')()
File "/dev/shm/polaris-clean/.venv/lib64/python3.7/site-packages/Click-7.0-py3.7.egg/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/dev/shm/polaris-clean/.venv/lib64/python3.7/site-packages/Click-7.0-py3.7.egg/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/dev/shm/polaris-clean/.venv/lib64/python3.7/site-packages/Click-7.0-py3.7.egg/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/dev/shm/polaris-clean/.venv/lib64/python3.7/site-packages/Click-7.0-py3.7.egg/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/dev/shm/polaris-clean/.venv/lib64/python3.7/site-packages/Click-7.0-py3.7.egg/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/dev/shm/polaris-clean/polaris/polaris.py", line 73, in cli_fetch
cache_dir, import_file)
File "/dev/shm/polaris-clean/polaris/fetch/data_fetch_decoder.py", line 287, in data_fetch_decode_normalize
end_date)
File "/dev/shm/polaris-clean/polaris/fetch/data_fetch_decoder.py", line 192, in data_fetch
return merge_csv_files(output_directory, cwd_path)
File "/dev/shm/polaris-clean/polaris/fetch/data_fetch_decoder.py", line 136, in merge_csv_files
with open(merged_file + '.tmp', 'r') as source:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/merged_frames.csv.tmp'
In this particular instance, this is happening because there were no LightSail-2 frames captured within the last hour (the default time that polaris fetch
will look back).
The error should be something more helpful. For instance:
There were no frames to download. Try expanding the time range with the --start_date and --end_date options.