Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

云函数写入问题 #5

Closed
Philbenzy opened this issue Aug 8, 2021 · 3 comments
Closed

云函数写入问题 #5

Philbenzy opened this issue Aug 8, 2021 · 3 comments

Comments

@Philbenzy
Copy link

utils.processJson("config.json").write(configs)
登录可以成功,但是这段代码在云函数里似乎有些问题,应该在云函数里是无法进行写入的!
执行结果:
`{

"errorCode": -1,

"errorMessage": "user code exception caught",

"requestId": "0935b0f9-7997-47fd-b77f-accd044692b0",

"stackTrace": "Traceback (most recent call last):\n File "/var/user/index.py", line 206, in main_handler\n loginStatus = wzxy.login()\n File "/var/user/index.py", line 45, in login\n self.setJwsession(jwsession)\n File "/var/user/index.py", line 63, in setJwsession\n utils.processJson("config.json").write(configs)\n File "/var/user/utils.py", line 36, in write\n with open(self.path,'w',encoding='utf-8') as file:\nOSError: [Errno 30] Read-only file system: 'config.json'",

"statusCode": 430

}执行日志:登陆成功`

@Chorer
Copy link
Contributor

Chorer commented Aug 8, 2021

是的,我看了一下文档。云函数不支持编写状态相关的代码,所以禁止文件读写操作。可以考虑接入云数据库,但有点大材小用了,而且云数据库不是免费的。回头再看看有什么其它解决方案

@Philbenzy
Copy link
Author

Philbenzy commented Aug 8, 2021 via email

@Chorer
Copy link
Contributor

Chorer commented Aug 8, 2021

是的,目前好一些的方法就是在Github上使用Action进行部署

------------------ 原始邮件 ------------------ 发件人: "zimin9/WoZaiXiaoYuanPuncher" @.>; 发送时间: 2021年8月8日(星期天) 下午4:04 @.>; @.@.>; 主题: Re: [zimin9/WoZaiXiaoYuanPuncher] 云函数写入问题 (#5) 是的,我看了一下文档。云函数不支持编写状态相关的代码,所以禁止文件读写操作。可以考虑接入云数据库,但是这个不是免费的。回头再看看有什么其它解决方案 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

可以使用 leancloud 的云存储服务 我摸索一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants