Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine GAE:如何在url中使用unicode字符_Google App Engine_Python 2.7_Sqlite_Url Routing - Fatal编程技术网

Google app engine GAE:如何在url中使用unicode字符

Google app engine GAE:如何在url中使用unicode字符,google-app-engine,python-2.7,sqlite,url-routing,Google App Engine,Python 2.7,Sqlite,Url Routing,我刚刚将GAE升级到1.7.6(python 2.7)。我的应用程序在URL中使用了一些西班牙语字符(如“españa”或“cádiz”)。到目前为止,我与他们打交道没有问题。然而,升级后,我一直收到错误消息和应用程序崩溃。我在url中引入了特殊字符: ProgrammingError('You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (li

我刚刚将GAE升级到1.7.6(python 2.7)。我的应用程序在URL中使用了一些西班牙语字符(如“españa”或“cádiz”)。到目前为止,我与他们打交道没有问题。然而,升级后,我一直收到错误消息和应用程序崩溃。我在url中引入了特殊字符:

ProgrammingError('You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.',)
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 1302, in communicate
req.respond()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 831, in respond
self.server.gateway(self).respond()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 2115, in respond
response = self.req.server.wsgi_app(self.env, self.start_response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/wsgi_server.py", line 230, in __call__
return app(environ, start_response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/server.py", line 1114, in __call__
return self._handle_request(environ, start_response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/server.py", line 512, in _handle_request
http_version=http_version)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/apiproxy_stub.py", line 160, in WrappedMethod
return method(self, *args, **kwargs)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/logservice/logservice_stub.py", line 151, in start_request
host, start_time, method, resource, http_version))
ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.
我编写了一个简单的应用程序来调试该问题,但没有任何积极的结果:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import webapp2

class MainHandler(webapp2.RequestHandler):
    def get(self):
        self.response.write('Hello world!')

class MyHandler(webapp2.RequestHandler):
  def get(self, param):
    self.response.write(param)

app = webapp2.WSGIApplication([
    ('/', MainHandler),
    ('/(.*)', MyHandler)
], debug=True)
访问URL“/hola”时,响应与预期一致,浏览器显示“hola”字。但是,当访问“/españa”甚至“/espa%C3%B1a”时,开发服务器会崩溃,并出现上述错误

注意,这个错误只发生在开发中,我猜它与新的sqlite数据库有关;但是,在前面的示例中,我根本没有使用数据库


有什么想法吗?求求你,救命

这似乎是dev服务器的一个bug。目前最好的办法是在GAE bug tracker:上启动bug

希望他们能更快地解决这个问题,如果更多的人“明星”它