Commit 3c064b17d143d5e7eebe91510acd355239ed7f3e

Authored by Goutte
1 parent 42c456c7

Ignore failures when opening gz files from the API, as we cannot trust the files to be valid, sadly.

Showing 1 changed file with 12 additions and 5 deletions   Show diff stats
web/run.py
... ... @@ -242,11 +242,18 @@ def retrieve_data(orbiter, what, started_at, stopped_at):
242 242 local_netc_file = local_gzip_file[0:-3]
243 243 local_netc_files.append(local_netc_file)
244 244 log.debug("Unzipping '%s'..." % local_gzip_file)
245   - with gzip.open(local_gzip_file, 'rb') as f:
246   - file_content = f.read()
247   - with open(local_netc_file, 'w+b') as g:
248   - g.write(file_content)
249   - log.debug("Unzipped '%s'." % local_gzip_file)
  245 + success = True
  246 + try:
  247 + with gzip.open(local_gzip_file, 'rb') as f:
  248 + file_content = f.read()
  249 + with open(local_netc_file, 'w+b') as g:
  250 + g.write(file_content)
  251 + except Exception as e:
  252 + success = False
  253 + log.warning("Cannot process gz file '%s' from '%s' : %s" %
  254 + (local_gzip_file, url, e))
  255 + if success:
  256 + log.debug("Unzipped '%s'." % local_gzip_file)
250 257  
251 258 return local_netc_files
252 259  
... ...