我正在尝试使用基于python的云功能将此fileX附加到电子邮件中。代码在localhost上运行良好,而在部署云功能时却出现此错误: [Errno 30]只读文件系统:'fileX.xlsx'
尝试写入Google云存储中的/ 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")
答案 0 :(得分:1)
根据您的需要,您可以更改文件的权限以使其可读和可写,也可以通过更改"r+b"
中的"r"
来更改附加文件的方式。