Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSError: [Errno 30] Read-only file system [duplicate]

I am trying to run my flask app to lambda. It deploy successfully (using serverless framework) but when I'm testing I get this error :

OSError: [Errno 30] Read-only file system

Part of the code that trigger the error :

with open("tmp/some-file.zip", "wb") as binary_file:
        binary_file.write(file_content)

Any suggestion ?

like image 542
John doe Avatar asked Dec 17 '25 21:12

John doe


1 Answers

In the provided example, you're using relative path to tmp, unless you're working dir is /, it will try to open a file in an invalid (not available for write) path. When trying to write to a file in /tmp (which is writable for Lambdas), ensure you're providing proper, ideally absolute path.

like image 59
pgrzesik Avatar answered Dec 20 '25 11:12

pgrzesik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!