UnicodeEncodeError on djangoappengine

1.6k views Asked by At

I've downloaded the djangoappengine project sample django-guestbook from www.allbuttonspressed.com to test how it works but the following error message is shown when I to access the URL localhost:8000

Traceback (most recent call last):
File "/usr/local/google_appengine/google/appengine/tools/dev_appserver.py", line 3245, in _HandleRequest self._Dispatch(dispatcher, self.rfile, outfile, env_dict) File "/usr/local/google_appengine/google/appengine/tools/dev_appserver.py", line 3186, in _Dispatch base_env_dict=env_dict) File "/usr/local/google_appengine/google/appengine/tools/dev_appserver.py", line 531, in Dispatch base_env_dict=base_env_dict) File "/usr/local/google_appengine/google/appengine/tools/dev_appserver.py", line 2410, in Dispatch self._module_dict) File "/usr/local/google_appengine/google/appengine/tools/dev_appserver.py", line 2299, in ExecuteCGI os.environ.update(env) File "/usr/lib64/python2.6/os.py", line 486, in update self[k] = dict[k] File "/usr/lib64/python2.6/os.py", line 471, in setitem putenv(key, item) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 19: ordinal not in range(128)

My version of Django now is 1.3.0 alpha, but I firstly tested with the version 1.1.1 and the same error occurred. The command manage.py runserver ran ok, and I didn't change nothing inside the project directory, I just downloaded, extracted e ran the server. I also tried to deploy the project (after change the app.yaml file, of course) but another error occurred.

Does someone have an idea of what could be happen? I tried everything I know for 7 uninterrupted hours, but I'm a little newbie yet. Thanks in advance.

2

There are 2 answers

2
Marc Abramowitz On BEST ANSWER

Well u'\xe1' is a lowercase A with an accent mark --> á

so my guess is that perhaps you used this character in a configuration file or you've stored the project in a directory that has the character in it? And then app engine is trying to use that in an environment variable name and that has to be ASCII.

0
Revil On

The problem is exactly what Marc had said. You've used an unicode character where you should use only ASCII. Probably in any config file or at the database data. Check the directory structure and grep over files that you've edited to customize them. Connect to database and check your recently added data fot that character.

Don't know how that app works, but what is sure is that you've written that á somewhere (assuming the app code is ok)