Read about our upcoming Code of Conduct on this issue

Commit d4ff6c18 authored by Martin von Zweigbergk's avatar Martin von Zweigbergk
Browse files

py3: also catch ImportError when relative import fails

Python 3 apparently raises an ImportError where Python 2 raised a
ValueError.
parent f30c1fab7155
......@@ -23,8 +23,9 @@ try:
obscache,
obsexchange,
)
except ValueError as exc:
if str(exc) != 'Attempted relative import in non-package':
except (ValueError, ImportError) as exc:
if (isinstance(exc, ValueError)
and str(exc) != 'Attempted relative import in non-package'):
raise
# extension imported using direct path
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment