diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2019-07-18 13:32:11 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2019-07-18 13:32:11 -0300 |
commit | 0fae0715f8e504284386def63b4f512a87a4a801 (patch) | |
tree | 46e2c5ef405d45555fb51eb06532b211d56c3c71 | |
parent | 49f9be7d6f29add47cd72bf2b9ef506baa746079 (diff) | |
download | grab-queue-0fae0715f8e504284386def63b4f512a87a4a801.tar.gz grab-queue-0fae0715f8e504284386def63b4f512a87a4a801.tar.bz2 |
Handle MemoryError
-rwxr-xr-x | grab-queue | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -271,13 +271,13 @@ if __name__ == "__main__": parser.set_defaults(progress=True) args = parser.parse_args() + # Initialize our dumper + queue = GrabQueue(args) + # Dispatch try: start_time = time.time() - # Initialize our dumper - queue = GrabQueue(args) - # Record date and invocation logs = ''.join(args.dest) + os.sep + 'logs' + os.sep queue.download.ensuredir(logs) @@ -298,6 +298,10 @@ if __name__ == "__main__": elapsed = open(logs + 'grab-queue.duration', 'a') elapsed.write(str(start_time) + '\t' + str(end_time) + '\t' + duration) elapsed.close() + except MemoryError as e: + print(e) + queue.dump_stats() + exit(1) except (FileNotFoundError, KeyboardInterrupt, subprocess.CalledProcessError) as e: print(e) exit(1) |