阅读背景:

在GAE本地devserver中使用GCS

来源:互联网 

Yesterday this code was working fine both in local and production servers:

昨天,这段代码在本地和生产服务器都运行良好:

import cloudstorage

def filelist(Handler):
    gs_bucket_name="/bucketname"
    list=cloudstorage.listbucket(gs_bucket_name)
    logging.warning(list)
    self.write(list)
    for e in list:
        self.write(e)
        self.write("<br>")

From yesterday to today I've upgraded GAE Launcher and changed the billing options (I was using a free trial and now a paid account) (not sure if it has anything to do, but just to give extra information)

从昨天到今天,我升级了GAE启动程序并更改了计费选项(我使用了免费试用,现在使用了付费帐户)

But today the code stopped working in local (works fine in production)

但是今天代码在本地停止工作(在生产中运行良好)

This is the beginning of the error log

这是错误日志的开始

WARNING  2015-02-20 09:50:21,721 admin.py:106] <cloudstorage.cloudstorage_api._Bucket object at 0x10ac31e90>

ERROR    2015-02-20 09:50:21,729 api_server.py:221] Exception while handling service_name: "app_identity_service"
method: "GetAccessToken"
request: "\n7https://www.googleapis.com/auth/devstorage.full_control"
request_id: "WoMrXkOyfe"

The warning shows a bucket object, but as soon as I try to iterate in the list I get the exception on the identity service.

警告显示一个bucket对象,但是当我尝试在列表中迭代时,就会得到标识服务上的异常。

What is hapening? Seems that I need to authorize local devserver gcs mockup, but I'm not sure how.

hapening是什么?似乎我需要授权本地devserver gcs模型,但我不确定如何。

Remember this is only happening in devserver, not in production.

请记住,这只发生在devserver中,而不是在产品中。

Thanks for your help

谢谢你的帮助

4 个解决方案

#1


5  

This is a problem with the latest release (1.9.18). For now, until it gets fixed, you can downgrade to 1.9.17 by downloading the installer from here and just running it: https://storage.googleapis.com/appengine-sdks/featured/GoogleAppEngineLauncher-1.9.17.dmg

这是最新版本(1.9.18)的问题。目前,在修复之前,您可以下载安装程序并运行它:https://storage.googleapis.com/appengine-sdks/featured/GoogleAppEngineLauncher-1.9.17.dmg

As per the answer below, the 1.9.18 has been patched with a fix for this. If you still want to install the 1.9.17 version, please follow this link: https://storage.googleapis.com/appengine-sdks/deprecated/1917/GoogleAppEngineLauncher-1.9.17.dmg

根据下面的答案,1.9.18已经被修复了。如果您还想安装1.9.17版本,请点击以下链接:https://storage.googleapis.com/appengine-sdks/deprecated/1917/GoogleAppEngineLauncher-1.9.17.dmg

#2


2  

It's a known bug in the dev_appserver, where the SDK does not cope with the credentials already persisted in earlier versions. For me (on Ubuntu 15.10 with SDK 1.9.33) it helped to simply remove a file:

在dev_appserver中,它是一个已知的bug,在这里,SDK不处理在早期版本中已经存在的凭据。对我来说(在Ubuntu 15.10和SDK 1.9.33上),它帮助我删除了一个文件:

rm ~/.config/gcloud/application_default_credentials.json

as suggested in the bug issue filed by Jari Wiklund.

正如Jari Wiklund在bug问题上提出的建议。

#3


1  

Update: As of March 5th, 2105 this was fixed in the public release of 1.9.18, which may be a simpler way to get the fix.

更新:从3月5日开始,2105已在1.9.18的公共版本中修复,这可能是获得修复的更简单的方法。

Note: while the fix was in Python, issue can surface in Java, PHP and Go also because they use the Python local dev server code.

注意:虽然修复是在Python中进行的,但是issue可以在Java、PHP中出现,而且Go也因为它们使用Python本地开发服务器代码。

#4


0  

I do believe that the cause of the problem is a bug in the local dev server (GoogleAppEngineLauncher), recently released. I'm experiencing something similar in the PHP runtime: GloudStorage fails locally

我确信问题的原因是本地开发服务器(GoogleAppEngineLauncher)最近发布的一个bug。我在PHP运行时中遇到了类似的情况:GloudStorage本地失败


分享到: