py3: also catch ImportError when relative import fails
Python 3 apparently raises an ImportError where Python 2 raised a
ValueError.
--- a/hgext3rd/evolve/serveronly.py Fri Jul 12 10:26:41 2019 -0700
+++ b/hgext3rd/evolve/serveronly.py Wed Jul 17 12:47:20 2019 -0700
@@ -23,8 +23,9 @@
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__)))