Consider this python 3 snippet, where when an import exception is raised, a string 'e' is created that says: "No module named ' packageName'".
The goal is to simply say on exit, that the import error can perhaps be solved by installing a package of the same name. I came up with this, and it works but I'd like to make it better, if anyone has some tips.
except ImportError as e: e = e.replace("No module named '", "") e = e.replace("'", "") sys.exit("'Error: Try sudo pip install %s'" % e)
Error: Try sudo pip install Crypto