make dirs with 'exist_ok=True' (#8629)

### What problem does this PR solve?

The following error occurred during local testing, which should be fixed
by configuring 'exist_ok=True'.

```log
set_progress(7461edc2535c11f0a2aa0242c0a82009), progress: -1, progress_msg: 21:41:41 Page(1~100000001): [ERROR][Errno 17] File exists: '/ragflow/tmp'
```

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
He Wang
2025-07-02 18:35:16 +08:00
committed by GitHub
parent 56e6f37ffa
commit 898da23caa

View File

@ -240,7 +240,7 @@ class QWenCV(Base):
# stupid as hell # stupid as hell
tmp_dir = get_project_base_directory("tmp") tmp_dir = get_project_base_directory("tmp")
if not os.path.exists(tmp_dir): if not os.path.exists(tmp_dir):
os.mkdir(tmp_dir) os.makedirs(tmp_dir, exist_ok=True)
path = os.path.join(tmp_dir, "%s.jpg" % get_uuid()) path = os.path.join(tmp_dir, "%s.jpg" % get_uuid())
Image.open(io.BytesIO(binary)).save(path) Image.open(io.BytesIO(binary)).save(path)
return [ return [
@ -262,7 +262,7 @@ class QWenCV(Base):
# stupid as hell # stupid as hell
tmp_dir = get_project_base_directory("tmp") tmp_dir = get_project_base_directory("tmp")
if not os.path.exists(tmp_dir): if not os.path.exists(tmp_dir):
os.mkdir(tmp_dir) os.makedirs(tmp_dir, exist_ok=True)
path = os.path.join(tmp_dir, "%s.jpg" % get_uuid()) path = os.path.join(tmp_dir, "%s.jpg" % get_uuid())
Image.open(io.BytesIO(binary)).save(path) Image.open(io.BytesIO(binary)).save(path)