Make relative imports explicit, and port some `except` statements to Python 3 syntax