加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

AWS LAMBDA“errorMessage”:“[Errno 30]只读文件系统:’driv

发布时间:2020-12-20 12:02:27 所属栏目:Python 来源:网络整理
导读:我在AWS Lambda中使用googledrive凭据时遇到问题,在我调用本地机器上的函数之前部署我的.zip文件之后,一切正常,但是我在AWS中部署zip后~30min我有lambda函数错误 "errorMessage": "[Errno 30] Read-only file system: 'drive-python-quickstart.json'","erro
我在AWS Lambda中使用googledrive凭据时遇到问题,在我调用本地机器上的函数之前部署我的.zip文件之后,一切正常,但是我在AWS中部署zip后~30min我有lambda函数错误

"errorMessage": "[Errno 30] Read-only file system: 'drive-python-quickstart.json'","errorType": "OSError","stackTrace": [
    [
      "/var/task/lambda_function.py",33,"lambda_handler","pageSize=10,fields="nextPageToken,files(id,name)").execute()"
    ],[
      "/var/task/oauth2client/_helpers.py",133,"positional_wrapper","return wrapped(*args,**kwargs)"
    ],[
      "/var/task/googleapiclient/http.py",835,"execute","method=str(self.method),body=self.body,headers=self.headers)"
    ],162,"_retry_request","resp,content = http.request(uri,method,*args,[
      "/var/task/oauth2client/transport.py",186,"new_request","credentials._refresh(orig_request_method)"
    ],[
      "/var/task/oauth2client/client.py",761,"_refresh","self._do_refresh_request(http)"
    ],802,"_do_refresh_request","self.store.locked_put(self)"
    ],[
      "/var/task/oauth2client/file.py",79,"locked_put","f = open(self._filename,'w')"
    ]
  ]
}

在文件file.py我有这个代码:

def locked_put(self,credentials):
    """Write Credentials to file.
    Args:
        credentials: Credentials,the credentials to store.
    Raises:
        IOError if the file is a symbolic link.
    """
    self._create_file_if_needed()
    _helpers.validate_file(self._filename)
    f = open(self._filename,'w')
    f.write(credentials.to_json())
    f.close()

def locked_delete(self):
    """Delete Credentials file.
    Args:
        credentials: Credentials,the credentials to store.
    """
    os.unlink(self._filename)

我尝试将f = open(self._filename,’w’)设置为’r’,但它没有帮助,也许谁知道我该如何修复它?请建议.

解决方法

显然你正在尝试写一个不允许的文件. Lambda目前仅支持将文件写入/ tmp目录.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读