Added workaround for swallowed ImportErrors by printing a traceback explicitly. Mostly resolves issue 17.

This commit is contained in:
Dirk Eschler 2010-03-06 01:40:26 +00:00
parent 8756af3494
commit 5fd7306b7e

View file

@ -15,8 +15,14 @@ from modeltranslation.translator import translator
try:
import translation
except ImportError:
sys.stderr.write("modeltranslation: Error can't find the file " \
"'translation.py' in your project root.\n")
sys.stderr.write("modeltranslation: Can't import the file 'translation.py'"
"from your project root.\n(If the file does indeed exist,"
"it's causing an ImportError somehow.)\n")
# For some reason ImportErrors raised in translation.py or in modules
# that are included from there become swallowed. Work around this problem
# by printing the traceback explicitly.
import traceback
traceback.print_exc()
sys.exit(1)
# After importing all translation modules, all translation classes are