From: Ben Darnell Date: Mon, 7 May 2012 01:09:51 +0000 (-0700) Subject: Make autoreload a little more robust against weird import failures X-Git-Tag: v2.3.0~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ef20e3fae02e29de11e660310c0f9952ffc00fe;p=thirdparty%2Ftornado.git Make autoreload a little more robust against weird import failures --- diff --git a/tornado/autoreload.py b/tornado/autoreload.py index 5baae0de3..286782c73 100644 --- a/tornado/autoreload.py +++ b/tornado/autoreload.py @@ -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()