[Scipy-svn] r3267 - trunk/scipy/weave

scipy-svn@scip... scipy-svn@scip...
Mon Aug 27 12:07:17 CDT 2007


Author: stefan
Date: 2007-08-27 12:07:05 -0500 (Mon, 27 Aug 2007)
New Revision: 3267

Modified:
   trunk/scipy/weave/catalog.py
Log:
Handle non-existent catalog file gracefully.


Modified: trunk/scipy/weave/catalog.py
===================================================================
--- trunk/scipy/weave/catalog.py	2007-08-27 16:16:49 UTC (rev 3266)
+++ trunk/scipy/weave/catalog.py	2007-08-27 17:07:05 UTC (rev 3267)
@@ -289,8 +289,9 @@
         msg = " mode must be 'c', 'n', 'r', or 'w'.  See anydbm for more info"
         raise ValueError, msg
     catalog_file = catalog_path(module_path)
-    if (dumb and os.path.exists(catalog_file+'.dat')) \
-           or os.path.exists(catalog_file):
+    if (catalog_file is not None) \
+           and ((dumb and os.path.exists(catalog_file+'.dat')) \
+                or os.path.exists(catalog_file)):
         sh = shelve.open(catalog_file,mode)
     else:
         if mode=='r':
@@ -552,7 +553,7 @@
             function exists with a warning.
         """
         writable_cat = None
-        if not os.path.exists(catalog_path):
+        if (catalog_path is not None) and (not os.path.exists(catalog_path)):
             return
         try:
             writable_cat = get_catalog(catalog_path,'w')



More information about the Scipy-svn mailing list