简体   繁体   English

Azure Function - 异常:OSError:[Errno 30] 只读文件系统:

[英]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:我正在尝试从 Excel 文件复制值,但它返回此错误消息:

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:

This is not related to Azure function, in general Only /tmp seems to be writable这个和Azure function没有关系,一般只有/tmp好像是可写的

Try adding tmp to the file path尝试将 tmp 添加到文件路径

filepath = '/tmp/' + key

I believe that Azure Function resource uses a linux based operating system.我相信 Azure Function 资源使用基于 linux 的操作系统。 All files are saved in the /tmp folder.所有文件都保存在 /tmp 文件夹中。

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然后你应该能够将任何数据保存到文件路径变量

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 结果:失败异常:OSError:[Errno 30] Python 和 Azure Function 上的只读文件系统 - Result: Failure Exception: OSError: [Errno 30] Read-only file system on Python and Azure Function 在 Python Azure Function 中使用 AzureML 时出现“失败异常:OSError:[Errno 30] 只读文件系统” - “Failure Exception: OSError: [Errno 30] Read-only file system” when using AzureML in Python Azure Function Azure function 应用程序:[Errno 30] 只读文件系统 - Azure function apps : [Errno 30] Read-only file system pipenv OSError: [Errno 30] 只读文件系统 - pipenv OSError: [Errno 30] Read-only file system 在 lambda 上使用 simpletransformers 时出现“[ERROR] OSError: [Errno 30] Read-only file system” docker - "[ERROR] OSError: [Errno 30] Read-only file system" when using simpletransformers on lambda docker Matplotlib savefig() OSError: [Errno 30] 只读文件系统:'image.png' - Matplotlib savefig() OSError: [Errno 30] Read-only file system: 'image.png' GCP App Engine:OSError:[Errno 30] 只读文件系统: - GCP App Engine: OSError: [Errno 30] Read-only file system: OSError:[Errno 30] 只读文件系统:'/User'。 macOS 卡特琳娜 - OSError: [Errno 30] Read-only file system: '/User'. macOS Catalina OSError: [Errno 30] Read-only file system when trying to open PDF in Python Code by Zapier - OSError: [Errno 30] Read-only file system when trying to open PDF in Python Code by Zapier AWS Lambda OSError(30, '只读文件系统') - AWS Lambda OSError(30, 'Read-only file system')
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM