mirror of
https://github.com/Hopiu/django-modeltranslation.git
synced 2026-05-17 09:11:06 +00:00
Added workaround for swallowed ImportErrors by printing a traceback explicitly. Mostly resolves issue 17.
This commit is contained in:
parent
8756af3494
commit
5fd7306b7e
1 changed files with 8 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue