gpt4 book ai didi

python - 转换为 Python 2.7 后图像服务出错

转载 作者:行者123 更新时间:2023-11-28 22:01:59 26 4
gpt4 key购买 nike

我正在将应用程序从 Python 2.5 切换到 2.7,并开始遇到图像服务问题。例如,使用 db.put() 保存此实体:

from google.appengine.api import images

class Images(db.Expando):
ImageTitle = db.StringProperty()
ImageFile = blobstore.BlobReferenceProperty()
ImageReference = db.StringProperty()

def put(self, **kwargs):
if not self.ImageReference:
self.ImageReference = images.get_serving_url(self.ImageFile.key())
super(Images, self).put(**kwargs)

现在产生这个错误:

Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 1536, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 1530, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 1102, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "C:\Users\VB User\Bruha\src\handler_product_page_image.py", line 40, in post
image.put()
File "C:\Users\VB User\Bruha\src\db_models.py", line 56, in put
self.ImageReference = images.get_serving_url(self.ImageFile.key())
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\images\__init__.py", line 1792, in get_serving_url
rpc = get_serving_url_async(blob_key, size, crop, secure_url, filename, rpc)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\images\__init__.py", line 1907, in get_serving_url_async
None)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\images\__init__.py", line 1034, in _make_async_call
rpc = create_rpc()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\images\__init__.py", line 1028, in create_rpc
return apiproxy_stub_map.UserRPC("images", deadline, callback)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 405, in __init__
self.__rpc = CreateRPC(service, stubmap)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 69, in CreateRPC
'a CreateRPC method.') % service)
AssertionError: The service "images" doesn't have a CreateRPC method.

调用“execute_transforms”方法也会产生同样的错误。

如果能帮助理解正在发生的事情,我们将不胜感激。

最佳答案

您正在运行开发服务器,因此当您启动时检查此消息“无法初始化图像 API;你可能错过了' 'Python“PIL”模块。导入错误:%s', e

如果您收到此消息,则图像服务 RPC 未注册(dev_appserver 中的 RegisterStub 调用将失败)并且您将收到您所看到的错误,因为断言在CreateRPC 调用。

因此检查 PIL 是否为 Python 2.7 正确安装

关于python - 转换为 Python 2.7 后图像服务出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12205464/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com