One of my favourite errors in Python is this one:

        File "settings.py", line 2
        SyntaxError: Non-ASCII character '\xce' in file settings.py on line 2,
        but no encoding declared; see http://www.python.org/peps/pep-0263.html 
for details

This is when you've declared a non-ASCII character without the encoding 
declared. In fact I don't even bother to look up the syntax to make it work, 
it's easier to put the text in, let it fail and then let python tell me the URL 
to the syntax.

There are common errors that I see being made in putting together Django 
applications and I'd like to see if we can provide more helpful errors to the 
user. There are obviously lots of places we can't do this, but I think in some 
areas we can. One example from #django last night that i've seen a few times is 
leaving a comma out in INSTALLED_APPS so you have:

        INSTALLED_APPS = (
            'django.contrib.auth'
            'django.contrib.contenttypes',
        ...)

This leads to:

        Error: No module named authdjango.contrib.contenttypes

Which is a pretty confusing error. Supposing this said:

        Error: No module named authdjango.contrib.contenttypes. See 
http://djangoproject.com/errors/32 for help.

And that page gave lots of detail:

        This means Django can't find an app from installed apps. This could be 
because:

        - You've misspelled it
 
        - You've missed a comma in INSTALLED_APPS

        ...

We've already got a page that seems similar to this at: 

        http://code.djangoproject.com/wiki/BetterErrorMessages

Ideally such errors would be part of the documentation.

This is of course won't be possible for all errors or all parts of Django, but 
would work for some of the more common errors that crop up regularly. Would 
this be a course worth pursuing?
--
  Andy McKay, @clearwind
  http://clearwind.ca/djangoski

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


Reply via email to