Nurdin
Nurdin

Reputation: 23893

Azure Function - Exception: OSError: [Errno 30] Read-only file system:

I'm trying to copy the value from the Excel file but it returns this error message:

Exception while executing function: Functions.extract Result: Failure
Exception: OSError: [Errno 30] Read-only file system: './data_download/xxxxx.xlsx'
Stack:   File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/dispatcher.py", line 343, in handle_invocation_request
    call_result = await self._loop.run_in_executor(
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/dispatcher.py", line 480, in __run_sync_func
    return func(**params)
  File "/home/site/wwwroot/extract/_init_.py", line 62, in main
    with open(download_file_path, "wb") as download_file:

My code

with open(download_file_path, "wb") as download_file:

Upvotes: 9

Views: 8456

Answers (3)

Tikhon
Tikhon

Reputation: 1024

Just in case anyone is struggling with this, I was going around and around trying to find an answer to this issue and the only thing that worked for me was found here:

https://github.com/Azure/azure-cli/issues/15211

enter image description here

enter image description here

Voila...

All is good.

Upvotes: 0

occurance_now
occurance_now

Reputation: 21

I believe that Azure Function resource uses a linux based operating system. All files are saved in the /tmp folder.

import tempfile
import os
   
local_path = tempfile.gettempdir()
filepath = os.path.join(local_path, filename)

And then you should be able to save any data to the filepath variable

Upvotes: 2

Sajeetharan
Sajeetharan

Reputation: 222702

This is not related to Azure function, in general Only /tmp seems to be writable

Try adding tmp to the file path

filepath = '/tmp/' + key

Upvotes: 13

Related Questions