for python3
fix except and module imports for python3