I have an API that is working smoothly on my local. Then, I tried to deploy my API with Space but I am always having a permission issue as below
File "/api/sabiduria_tool_api/services/service_sabiduria_tool.py", line 35, in save_files
mkdir(self.data_store_path)
PermissionError: [Errno 13] Permission denied: '/api/sabiduria_tool_api/data/'
Here is the method that is failing
async def save_files(self) -> None:
if isdir(self.data_store_path):
old_files = self.get_files()
for o_file in old_files:
remove(f"{self.data_store_path}{o_file}")
else:
mkdir(self.data_store_path)
for file in self.files:
with open(f"{self.data_store_path}{file.filename}", "wb") as destination:
copyfileobj(file.file, destination)
Here is my docker file
FROM python:3.9.7
COPY ./requirements.txt /api/requirements.txt
COPY ./sabiduria_tool_api /api/sabiduria_tool_api
WORKDIR /api
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
CMD ["uvicorn", "sabiduria_tool_api.main:app", "--host", "0.0.0.0", "--port", "7860"]
Is there a way that I can create a folder?