gpt4 book ai didi

python - AWS LAMBDA "errorMessage": "[Errno 30] Read-only file system: ' drive-python-quickstart. json'"

转载 作者:行者123 更新时间:2023-12-01 22:42:45 26 4
gpt4 key购买 nike

我在 AWS Lambda 中的 googledrive 凭证有问题,在我在本地计算机上调用该函数之前部署 .zip 文件后,一切正常,但在大约 30 分钟后在 AWS 中部署 zip 后,我遇到了 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)"
],
[
"/var/task/googleapiclient/http.py",
162,
"_retry_request",
"resp, content = http.request(uri, method, *args, **kwargs)"
],
[
"/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)"
],
[
"/var/task/oauth2client/client.py",
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 目录。

关于python - AWS LAMBDA "errorMessage": "[Errno 30] Read-only file system: ' drive-python-quickstart. json'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45608923/

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