make pyximport work with empty path entries in sys.path (== CWD)
authorStefan Behnel <scoder@users.berlios.de>
Sun, 25 Jan 2009 18:11:43 +0000 (19:11 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sun, 25 Jan 2009 18:11:43 +0000 (19:11 +0100)
pyximport/pyximport.py

index 542bb5ebf538505c2d3be008bc95bab3427f5e9d..2aa1bf20b4d8cd41b5fc11494ada9852fb79a94d 100644 (file)
@@ -176,7 +176,13 @@ class PyxImporter(object):
             paths = sys.path
         join_path = os.path.join
         is_file = os.path.isfile
-        for path in filter(os.path.isdir, paths):
+        is_dir = os.path.isdir
+        for path in paths:
+            if not is_dir(path):
+                if not path:
+                    path = os.getcwd()
+                else:
+                    continue
             for filename in os.listdir(path):
                 if filename == pyx_module_name:
                     return PyxLoader(fullname, join_path(path, filename),