# HG changeset patch # User Martin von Zweigbergk # Date 1563392840 25200 # Node ID 7e034d44bd4ba89d0efdc0be0454cad9fce3bc2d # Parent f30c1fab7155ef5ffd3dd4a4a6076f1dfed26452 py3: also catch ImportError when relative import fails Python 3 apparently raises an ImportError where Python 2 raised a ValueError. diff -r f30c1fab7155 -r 7e034d44bd4b hgext3rd/evolve/serveronly.py --- 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__)))