Azure Function Python 3.7 file system is read-only

David Bros 1 Reputation point
2020-07-02T15:11:37.277+00:00

Good morning, I have an issue (it's probably me not finding the right settings) relating to editing zip files in an azure function.

I am currently testing an azure function that is supposed to receive a zip file in bytes, save it, tweak it and then return it as bytes in the httpResponse object, this works fine testing locally with VSCode in Windows 10 pro, however, when I publish the function and make an http request to it with Postman I get an exception saying:

read-only file system

Is there a way to set up a read and write file system for the function?
I tried func azure functionapp publish my_functionapp_name --nozip as mentioned in this post : (https://stackoverflow.com/questions/53630773/how-to-disable-read-only-mode-in-azure-function-app) but it does not seem to work for me. I'd appreciate it if you could point me in the right direction.

Cheers!

David.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,323 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Krish G 2,326 Reputation points
    2020-07-20T08:42:03.057+00:00

    Hello @David Bros ,

    While changing the deployment mode from 'run from package' to 'web publish' is an option to enable write access, but not needed and not recommended since run from package adds several benefits as mentioned here.

    The recommended location for writing data is /home/data (for example,

    from pathlib import Path  
    data= str(Path.home()) + "/data"  
    

    ).
    Alternatively, if it is transient data only intended for the local function execution, then writing to tmp directory (for example, using tempfile module in python and get temp directory by

    tempfile.gettempdir()  
    

    ) is also a faster option.

    1 person found this answer helpful.