new to Django and Python

275 views
Skip to first unread message

Register, Brent (CMG-Atlanta)

unread,
Dec 26, 2013, 3:44:24 PM12/26/13
to django...@googlegroups.com
I get an error message when I run the 
"$ python manage.py syncdb"
Command.  


70
SyntaxError: Non-ASCII character '\xe2' in file /Users/bmregister/djangoLocal/myFirstSite/myFirstSite/settings.py on line 70, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

I can’t find any characters ‘/xe2’ anywhere in the settings.py file, line 70 or other wise?  I am editing the file in the Xcode IDE.  The pep article really doesn’t help me much.  Any suggestions or ideas on what needs to be edited in my settings.py file?

Brent.



Diogene Laerce

unread,
Dec 26, 2013, 9:05:23 PM12/26/13
to django...@googlegroups.com

On 12/27/2013 03:44 AM, Register, Brent (CMG-Atlanta) wrote:
> I get an error message when I run the
> "$ python manage.py syncdb"
> Command.
>
>
> 70
> SyntaxError: Non-ASCII character '\xe2' in file
> /Users/bmregister/djangoLocal/myFirstSite/myFirstSite/settings.py on
> line 70, but no encoding declared; see
> http://www.python.org/peps/pep-0263.html for details
>
> I can�t find any characters �/xe2� anywhere in the settings.py file,
> line 70 or other wise? I am editing the file in the Xcode IDE. The pep
> article really doesn�t help me much. Any suggestions or ideas on what
> needs to be edited in my settings.py file?

Hi, When you save your file in your IDE, are you sure that you save it
as UTF-8 ?

--
�One original thought is worth a thousand mindless quotings.�
�Le vrai n'est pas plus s�r que le probable.�

Diogene Laerce

trojactory

unread,
Dec 27, 2013, 1:52:18 AM12/27/13
to django...@googlegroups.com
Hi Brent,

Did you try the suggestions in the PEP link? Try adding this line at the top of the file:

# coding: utf-8

Cheers,
Arun

Damián Pérez

unread,
Dec 27, 2013, 10:19:00 AM12/27/13
to django...@googlegroups.com
this is because you are use special characters. you can include in you python files:

# -*- coding: utf-8 -*-

regards,

向量

unread,
Jan 7, 2014, 11:04:29 PM1/7/14
to django...@googlegroups.com
oh, my god.
your db have problem,
what db you use, mysql or sqlite?



在 2013年12月27日星期五UTC+8上午4时44分24秒,Brent Register写道:

Hans S. Tømmerholt

unread,
Jan 8, 2014, 6:58:34 AM1/8/14
to django...@googlegroups.com
This seems to be a weird "'"-like character in the settings file. You'd see the character, not its Unicode code. Look carefully and try replacing it with a proper "'".


If you need to have non-ASCII characters in your source code files (us Norwegians sometimes use æøå, for example), you'd need to add something like this to the top of the Python source file:

# coding=UTF-8

and remember to save it with the proper encoding, UTF-8 in this case.

--
Vennlig hilsen/Best regards
Hans S. Tømmerholt
Project manager, Web sites
Reply all
Reply to author
Forward
0 new messages