Take Django for example in manage.py:
try:
import settings
except ImportError:
sys.stderr.write("Error: Can't find the file 'settings.py'...")
It seems legal, but what happens when it settingsimports non_existant_lib_foo?
Well, you were sent to chase the geese for all the possible things that you could do with help PATH, etc.
Of course, you can use except ImportError as e:and simply print the actual error message, but what if you want to catch only a specific error and give really good advice, for example above?
You no longer want to use regexp or, at best, assume that the "right" module could not import and then display the message.
Is there a better way to handle this?