1

I am trying to attach this fileX to an email using a python-based cloud-function. The code runs fine on localhost while it gives this error when I deploy the cloud-function: [Errno 30] Read-only file system: 'fileX.xlsx'

Have tried writing to the /tmp directory in google cloud storage, but to no resolve.

    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")

2 Answers2

1

Depending on your need, you can either change your file's permissions in order to make it both readable and writable or change the way you attach it by changing the "r+b" in "r".

AdriBento
  • 589
  • 5
  • 16
0

Google Cloud Functions runtime is read-only except for /tmp.

Take a look at Google Clould Functions deploy: EROFS: read-only file system

Crispy Holiday
  • 412
  • 1
  • 9
  • 28