Im getting "The server encountered an error and could not complete your request" error
Im getting "The server encountered an error and could not complete your request" error in my google app engine:
my app.yaml:
application: myapp
version: 2
runtime: python
api_version: 1
builtins:
- remote_api: on
- datastore_admin: on
handlers:
- url: /AJAX
script: main.py
- url: /emailtrigger
script: main.py
- url: /emailworker
script: main.py
- url: /
static_files: static_files/index.html
upload: static_files
- url: /
static_dir: static_files
开发者_Go百科
error in log:
<type 'exceptions.SyntaxError'>: Non-ASCII character '\xc3' in file /base/data/home/apps/myapp/2.349019521625775975/main.py on line 77, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details (main.py, line 77)
I have a string with a character: ã; the main.py is utf-8 encoded
- try adding this as first line of your code
# -- coding: utf-8 --
try coverting your strings to unicode
self.response.out.write(unicode("ã","UTF-8"))
精彩评论