Commits

Łukasz Langa  committed b0efd74

Fix for spurious ImportWarnings when python is invoked with -Wd

  • Participants
  • Parent commits 535b969

Comments (0)

Files changed (1)

File bpython/importcompletion.py

 import imp
 import os
 import sys
+import warnings
 
 py3 = sys.version_info[:2] >= (3, 0)
 
             continue
         name = os.path.splitext(name)[0]
         try:
-            fo, pathname, _ = imp.find_module(name, [path])
+            with warnings.catch_warnings():
+                warnings.simplefilter("ignore", ImportWarning)
+                fo, pathname, _ = imp.find_module(name, [path])
         except (ImportError, SyntaxError):
             continue
         except UnicodeEncodeError: