Robert Brewer committed 09ceda5

Fix for #438 ( Server fails to start if a .pyc is imported with no corresponding .py).

Comments (0)

Files changed (1)

                 if filename.endswith(".pyc"):
                     filename = filename[:-1]
+                oldtime = self.mtimes.get(filename, 0)
+                if oldtime is None:
+                    # Module with no .py file. Skip it.
+                    continue
                     mtime = os.stat(filename).st_mtime
                 except OSError:
-                    if filename in self.mtimes:
-                        # The file was probably deleted.
-                        self.reexec()
+                    # Either a module with no .py file, or it's been deleted.
+                    mtime = None
                 if filename not in self.mtimes:
+                    # If a module has no .py file, this will be None.
                     self.mtimes[filename] = mtime
-                    continue
-                if mtime > self.mtimes[filename]:
-                    # The file has been modified.
-                    self.reexec()
+                else:
+                    if mtime is None or mtime > oldtime:
+                        # The file has been deleted or modified.
+                        self.reexec()
     def stop(self):
         """Stop the application engine."""
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.