GAE开发:UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xb0 in position 1: ordinal not in range(128)

发表于

先上Log:

 

2014-01-11 14:51:19 Running command: "['D:\\development\\Python27\\pythonw.exe', 'D:\\development\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=10080', '--admin_port=8002', u'D:\\development\\Google\\google_appengine\\projects\\helloworld']"

Traceback (most recent call last):

File "D:\development\Google\google_appengine\dev_appserver.py", line 197, in <module>

_run_file(__file__, globals())

File "D:\development\Google\google_appengine\dev_appserver.py", line 193, in _run_file

execfile(script_path, globals_)

File "D:\development\Google\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 32, in <module>

from google.appengine.tools.devappserver2.admin import admin_server

File "D:\development\Google\google_appengine\google\appengine\tools\devappserver2\admin\admin_server.py", line 29, in <module>

from google.appengine.tools.devappserver2.admin import console

File "D:\development\Google\google_appengine\google\appengine\tools\devappserver2\admin\console.py", line 22, in <module>

from google.appengine.tools.devappserver2 import module

File "D:\development\Google\google_appengine\google\appengine\tools\devappserver2\module.py", line 69, in <module>

from google.appengine.tools.devappserver2 import wsgi_server

File "D:\development\Google\google_appengine\google\appengine\tools\devappserver2\wsgi_server.py", line 31, in <module>

from cherrypy import wsgiserver

File "D:\development\Google\google_appengine\lib\cherrypy\cherrypy\__init__.py", line 70, in <module>

from cherrypy import _cptools

File "D:\development\Google\google_appengine\lib\cherrypy\cherrypy\_cptools.py", line 245, in <module>

from cherrypy.lib import cptools, encoding, auth, static, jsontools

File "D:\development\Google\google_appengine\lib\cherrypy\cherrypy\lib\static.py", line 7, in <module>

mimetypes.init()

File "D:\development\Python27\lib\mimetypes.py", line 358, in init

db.read_windows_registry()

File "D:\development\Python27\lib\mimetypes.py", line 258, in read_windows_registry

for subkeyname in enum_types(hkcr):

File "D:\development\Python27\lib\mimetypes.py", line 249, in enum_types

ctype = ctype.encode(default_encoding) # omit in 3.x!

UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinal not in range(128)

2014-01-11 14:51:21 (Process exited with code 1)

解决方法:

到Python的安装目录$python$下,在$python$/lib/mimetypes.py中,找到

try:

ctype = ctype.encode(default_encoding) # omit in 3.x!

except UnicodeEncodeError:

pass

将其注释