@Mehul Makkar Welcome to Microsoft Q&A Forum, Thank you for posting your query here!
I see that you are facing Read-Only file system
error when trying to write a dataframe to a blob in an Azure storage account using a Python Azure Function.
The error message indicates that the file system is read-only, could be due to many reasons.
I understand that locally the same code is working fine as expected and the issue is only after deploying to Azure.
To resolve this issue, you can check the following:
- Plan 1:
The function app file system is read only by default. To perform the Read/write on the storage, Could you please use the storage bindings ? Ensure that the output binding is configured correctly. The configuration needed for output binding is explained here. - Plan 2:
Also ensure that the path exists. The path should be given in the format
PATH/TO/BLOB
. Example:containerName\mypath\Test12.xlsx
. Could you please confirm if you have the right path within your function.json ? Refer the v2 and v2 samples here and here. - Plan 3: Please check this thread and see if that helps:
- Plan 4: Are you making use of the temporary folder to write the processed date ? If yes, The tempfile.gettempdir() method returns a temporary folder, which on Linux is /tmp. Your application can use this directory to store temporary files that are generated and used by your functions when they're running. More Info here.
- Plan 5:
Are you trying to save the blob first and the after modifying it you are uploading it to storage ? Are you using
blobService.get_blob_to_path
? Please check from the Azure portal if you have theWEBSITE_RUN_FROM_ZIP
orWEBSITE_RUN_FROM_PACKAGE
settings added within your Function App settings ? If yes, then your filesystem would be readonly. More info here and here.
Hope this helps.
If the above information doesn't help, Please share the sample code snippet, and steps to reproduce this issue. I will try to check at my end and see if I can reproduce this issue.
Sharing some of the similar threads where the same issue was discussed: https://learn.microsoft.com/en-us/answers/questions/283950/azure-file-system-read-only-error-azure-function https://learn.microsoft.com/en-us/answers/questions/884340/read-only-file-system-error-in-azureml-studio https://stackoverflow.com/questions/63318567/azure-function-exception-oserror-errno-30-read-only-file-system https://www.appsloveworld.com/azure-functions/27/azure-function-apps-errno-30-read-only-file-system https://github.com/Azure/azure-functions-python-worker/issues/733 https://learn.microsoft.com/en-us/answers/questions/1002268/azure-functions-directory-read-only-on-linux
**
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.