Browse code

Print a useful error message when MemoryError is raised

Matt Domsch authored on 2013/12/14 14:16:45
Showing 1 changed files
... ...
@@ -2292,6 +2292,17 @@ if __name__ == '__main__':
2292 2292
         sys.stderr.write("See ya!\n")
2293 2293
         sys.exit(1)
2294 2294
 
2295
+    except MemoryError:
2296
+        msg = """
2297
+MemoryError!  You have exceeded the amount of memory available for this process.
2298
+This usually occurs when syncing >750,000 files on a 32-bit python instance.
2299
+The solutions to this are:
2300
+1) sync several smaller subtrees; or
2301
+2) use a 64-bit python on a 64-bit OS with >8GB RAM
2302
+        """
2303
+        sys.stderr.write(msg)
2304
+        sys.exit(1)
2305
+
2295 2306
     except Exception, e:
2296 2307
         report_exception(e)
2297 2308
         sys.exit(1)