Make autoreload a little more robust against weird import failures

This commit is contained in:
Ben Darnell 2012-05-06 18:09:51 -07:00
parent 8f44acda38
commit 9ef20e3fae
1 changed files with 3 additions and 1 deletions

View 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()