繁体   English   中英

尝试在 firebase 云 function 中打开 xlsx 时,如何解决“[Errno 30] 只读文件系统”错误?

[英]How do I tackle with the "[Errno 30] Read-only file system" error, while trying to open an xlsx in a firebase cloud function?

我正在尝试使用基于 python 的云函数将此 fileX 附加到 email。 代码在本地主机上运行良好,但在我部署云功能时出现此错误:[Errno 30] Read-only file system: 'fileX.xlsx'

已尝试写入谷歌云存储中的 /tmp 目录,但没有解决。

    df_en.to_excel(writer, sheet_name='en')
    df_hi.to_excel(writer, sheet_name='hi')
    writer.save()
    filename = "fileX.xlsx"
    attachment = open("/tmp/fileX.xlsx", "r+b")

根据您的需求,您可以更改,以使其可读可写或改变您可以通过更改附加的方式你的文件的权限"r+b"中的"r"

除了/tmp之外,Google Cloud Functions 运行时是只读的。

看一下Google Clould Functions 部署:EROFS:只读文件系统

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM