Different kinds of Import Errors
Thomas Guettler
hv at tbz-pariv.de
Tue Nov 27 08:35:34 EST 2007
If you look at this code, you see there are two kind of ImportErrors:
1. app_name has no attribute or file managment.py: That's OK.
2. managment.py exists, but raises an ImportError: That's not OK: reraise
# Import the 'management' module within each installed app, to register
# dispatcher events.
for app_name in settings.INSTALLED_APPS:
try:
__import__(app_name + '.management', {}, {}, [''])
except ImportError, exc:
if exc.args[0]!='No module named management':
raise
I am searching a better solution, since in a future version of python
the string 'No module namend management' might be changed.
Any better solution?
More information about the Python-list
mailing list