# Permission Error for creating a directory in python using os.makedirs

**URL:** <https://discuss.huggingface.co/t/permission-error-for-creating-a-directory-in-python-using-os-makedirs/82573>\
**Category:** Spaces\
**Created:** [April 19, 2024, 7:14am UTC](https://discuss.huggingface.co/t/permission-error-for-creating-a-directory-in-python-using-os-makedirs/82573 "2024-04-19T07:14:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![i-darrshan](https://avatars.discourse-cdn.com/v4/letter/i/f1d935/32.png) [@i-darrshan](https://discuss.huggingface.co/u/i-darrshan)\
**Post date:** [April 19, 2024, 7:14am UTC](https://discuss.huggingface.co/t/permission-error-for-creating-a-directory-in-python-using-os-makedirs/82573/1 "2024-04-19T07:14:48Z")

</div>

I have this in Dockerfile:

# Use the official Python image from the Docker Hub with Python 3.9.12

FROM python:3.9.12

# Set environment variables

ENV PYTHONDONTWRITEBYTECODE 1

ENV PYTHONUNBUFFERED 1

# Set the working directory inside the container

WORKDIR /app

# Copy the entire directory into the container

COPY . /app

# Install required system packages

RUN apt-get update && apt-get install -y \

libgl1-mesa-glx \

&& rm -rf /var/lib/apt/lists/\*

# Install required Python packages

RUN pip install --no-cache-dir flask tensorflow jsonify

RUN pip install --no-cache-dir gunicorn

# Expose port 5000 to the outside world

EXPOSE 5000

# Command to run the Gunicorn server with 4 worker processes

CMD [“gunicorn”, “–workers”, “2”, “–timeout”, “180”, “–bind”, “0.0.0.0:5000”, “app:app”]

I am getting permission error when my app.py runs, telling:

…  
os.makedirs(temp\_folder, exist\_ok=True)  
File “/usr/local/lib/python3.9/os.py”, line 225, in makedirs  
mkdir(name, mode)  
PermissionError: [Errno 13] Permission denied: ‘temporary’  
[2024-04-19 06:57:15 +0000] [8] [INFO] Worker exiting (pid: 8)  
[2024-04-19 06:57:15 +0000] [1] [ERROR] Worker (pid:7) exited with code 3  
[2024-04-19 06:57:15 +0000] [1] [ERROR] Worker (pid:8) was sent SIGTERM!  
[2024-04-19 06:57:15 +0000] [1] [ERROR] Shutting down: Master  
[2024-04-19 06:57:15 +0000] [1] [ERROR] Reason: Worker failed to boot.
