#12300: Catching exceptions and printing messages without file name and line 
number
---------------------------+------------------------------------------------
 Reporter:  zimnyx         |       Owner:  nobody    
   Status:  new            |   Milestone:            
Component:  Uncategorized  |     Version:  SVN       
 Keywords:  ImportError    |       Stage:  Unreviewed
Has_patch:  0              |  
---------------------------+------------------------------------------------
 Hello!

 Lately I had a typo in app name in INSTALLED_APPS. What I get from django
 when trying to run manage.py shell, test etc. was:
 {{{
 $ python manage.py shell
 Error: No module named name_with_typo
 }}}
 Like you see this message just suggest, that importing were wrong, because
 module is not accessible.
 If my module name was really "name_with_typo" I would find it very fast,
 but my name was "model", so browsing sources to find the reason was a bit
 exhausting.
 I start debugger and find that exception was catched here:
 {{{
 # django/core/management/base.py:205
         """
         # Switch to English, because django-admin.py creates database
 content
         # like permissions, and those shouldn't contain any translations.
         # But only do this if we can assume we have a working settings
 file,
         # because django.utils.translation requires settings.
         if self.can_import_settings:
             try:
                 from django.utils import translation
                 translation.activate('en-us')
             except ImportError, e:
                 # If settings should be available, but aren't,
                 # raise the error and quit.
                 sys.stderr.write(self.style.ERROR(str('Error: %s\n' % e)))
                 sys.exit(1)
 }}}

 Exception was raised during
 {{{
 translation.activate('en-us')
 }}}
 As you see it's not much intuitive...

 Why not to make error message more verbose?
 It would save our time.

 PS.
 Such "error handling" is used in many places of Django.


 Cheers!

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12300>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--

You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.


Reply via email to