]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Make autoreload a little more robust against weird import failures
authorBen Darnell <ben@bendarnell.com>
Mon, 7 May 2012 01:09:51 +0000 (18:09 -0700)
committerBen Darnell <ben@bendarnell.com>
Mon, 7 May 2012 01:09:51 +0000 (18:09 -0700)
tornado/autoreload.py

index 5baae0de3d581b14b43c6f781380320f1cdcb10f..286782c7371e213ef6a1b94f456dcf507bfaf850 100644 (file)
@@ -280,7 +280,9 @@ def main():
     if mode == 'module':
         # runpy did a fake import of the module as __main__, but now it's
         # no longer in sys.modules.  Figure out where it is and watch it.
-        watch(pkgutil.get_loader(module).get_filename())
+        loader = pkgutil.get_loader(module)
+        if loader is not None:
+            watch(loader.get_filename())
 
     wait()