Re: Non-ASCII character - strange error
On Wed, 2008-11-19 at 21:24 +0900, Dominic Ashton wrote: > > Guys, > > > Just had the strangest thing happened. > > Finished working on my project last night and everything was working > fine. I backed up the directory using tar, log on today and start my > development server and get the following error message: > > > Traceback (most recent call last): > File "manage.py", line 11, in > execute_manager(settings) > File > "/var/lib/python-support/python2.5/django/core/management/__init__.py", line > 338, in execute_manager > setup_environ(settings_mod) > File > "/var/lib/python-support/python2.5/django/core/management/__init__.py", line > 316, in setup_environ > project_module = __import__(project_name, {}, {}, ['']) > File "/home/dash/djang/pos/../post/__init__.py", line 1 > SyntaxError: Non-ASCII character '\xa3' in > file /home/dash/djang/pos/../post/__init__.py on line 2, but no > encoding declared; see http://www.python.org/peps/pep-0263.html for > details > > > > I just fixed the problem, by starting a new project, a new app, then > using the same mysql database and simply copying models.py and > admin .py from my old app folder to the new folder. Now it's working > without problem. > > I am living in Japan and do occasionally type japanese, but i'm almost > sure there were no non latin chars at any point in any of my code. Non-latin isn't the issue. Non-ASCII is what it's complaining about ("Latin" usually encompasses things like latin1, a.k.a. ISO-8859-1, which contains plenty of non-ASCII characters). If you were really interested in which characters were at issue here, you could do something like this at the Python prompt (there are other ways, too, of course, but this is the one-liner): [p for (p, c) in enumerate(open('myfile').read()) if ord(c) > 127] That will return a list of positions of characters that are non-ASCII. Regards, Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Non-ASCII character - strange error
Try put: # -*- coding: utf-8 -*- in first line in .py file Maybe you need change utf-8 to your encoding Dominic Ashton pisze: > > Guys, > > > Just had the strangest thing happened. > > Finished working on my project last night and everything was working > fine. I backed up the directory using tar, log on today and start my > development server and get the following error message: > > > Traceback (most recent call last): > File "manage.py", line 11, in > execute_manager(settings) > File > "/var/lib/python-support/python2.5/django/core/management/__init__.py", > line 338, in execute_manager > setup_environ(settings_mod) > File > "/var/lib/python-support/python2.5/django/core/management/__init__.py", > line 316, in setup_environ > project_module = __import__(project_name, {}, {}, ['']) > File "/home/dash/djang/pos/../post/__init__.py", line 1 > SyntaxError: Non-ASCII character '\xa3' in file > /home/dash/djang/pos/../post/__init__.py on line 2, but no encoding > declared; see http://www.python.org/peps/pep-0263.html for details > > > > I just fixed the problem, by starting a new project, a new app, then > using the same mysql database and simply copying models.py and admin > .py from my old app folder to the new folder. Now it's working without > problem. > > I am living in Japan and do occasionally type japanese, but i'm almost > sure there were no non latin chars at any point in any of my code. > > Has anyone ever heard of this before? What could of caused it? not the > tar surely? > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Non-ASCII character - strange error
Guys, Just had the strangest thing happened. Finished working on my project last night and everything was working fine. I backed up the directory using tar, log on today and start my development server and get the following error message: Traceback (most recent call last): File "manage.py", line 11, in execute_manager(settings) File "/var/lib/python-support/python2.5/django/core/management/__init__.py", line 338, in execute_manager setup_environ(settings_mod) File "/var/lib/python-support/python2.5/django/core/management/__init__.py", line 316, in setup_environ project_module = __import__(project_name, {}, {}, ['']) File "/home/dash/djang/pos/../post/__init__.py", line 1 SyntaxError: Non-ASCII character '\xa3' in file /home/dash/djang/pos/../post/__init__.py on line 2, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details I just fixed the problem, by starting a new project, a new app, then using the same mysql database and simply copying models.py and admin .py from my old app folder to the new folder. Now it's working without problem. I am living in Japan and do occasionally type japanese, but i'm almost sure there were no non latin chars at any point in any of my code. Has anyone ever heard of this before? What could of caused it? not the tar surely? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---