Made lexicon unpickling more robust; on error it regenerates it.
authorHoyt Koepke hoytak@gmail.com <none@none>
Tue, 17 Mar 2009 03:10:14 +0000 (20:10 -0700)
committerHoyt Koepke hoytak@gmail.com <none@none>
Tue, 17 Mar 2009 03:10:14 +0000 (20:10 -0700)
Cython/Compiler/Scanning.py

index 9ef47dc116d3055b3abf1f1ecfa9c9f94244cafa..6c2144fc5a0fa0301673760c4759210a22d8d9ac 100644 (file)
@@ -102,7 +102,12 @@ def try_to_unpickle_lexicon():
         if notify_lexicon_unpickling:
             t0 = time()
             print("Unpickling lexicon...")
-        lexicon = pickle.load(f)
+        try:
+            lexicon = pickle.load(f)
+        except Exception, e:
+            print "WARNING: Exception while loading lexicon pickle, regenerating"
+            print e
+            lexicon = None
         f.close()
         if notify_lexicon_unpickling:
             t1 = time()