[PR #5649] [MERGED] fix: close temporary file after creating it #8523

Closed
opened 2025-11-11 17:58:42 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/5649
Author: @EtiennePerot
Created: 9/24/2024
Status: Merged
Merged: 9/24/2024
Merged by: @tjbck

Base: devHead: temp-file-close


📝 Commits (1)

  • fdd27aa fix: close temporary file after creating it.

📊 Changes

1 file changed (+2 additions, -1 deletions)

View changed files

📝 backend/open_webui/apps/webui/utils.py (+2 -1)

📄 Description

This fixes "The process cannot access the file because it is being used by another process" errors on Windows.

The file is still automatically deleted by the os.unlink call later in the function.

Updates #5606
Fixes #5642

Pull Request Checklist

Before submitting, make sure you've checked the following:

  • Target branch: dev
  • Description: See above.
  • Changelog: See below.
  • Documentation: No documentation to update.
  • Dependencies:: No new dependencies.
  • Testing:: Manually verified in a Windows VM that calling os.unlink(temp_file.name) before calling temp_file.close() causes this error, and that calling temp_file.close() before os.unlink(temp_file.name) does not.
  • Code review:: OK.
  • Prefix: fix

Changelog Entry

Fixed

  • Fix "The process cannot access the file because it is being used by another process" issue when adding functions/tools on Windows.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/5649 **Author:** [@EtiennePerot](https://github.com/EtiennePerot) **Created:** 9/24/2024 **Status:** ✅ Merged **Merged:** 9/24/2024 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `temp-file-close` --- ### 📝 Commits (1) - [`fdd27aa`](https://github.com/open-webui/open-webui/commit/fdd27aa3213f7fa4b4cbc3455a7a520a92d254b3) fix: close temporary file after creating it. ### 📊 Changes **1 file changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/apps/webui/utils.py` (+2 -1) </details> ### 📄 Description This fixes "The process cannot access the file because it is being used by another process" errors on Windows. The file is still automatically deleted by the `os.unlink` call later in the function. Updates #5606 Fixes #5642 # Pull Request Checklist **Before submitting, make sure you've checked the following:** - [x] **Target branch:** `dev` - [x] **Description:** See above. - [x] **Changelog:** See below. - [x] **Documentation:** No documentation to update. - [x] **Dependencies:**: No new dependencies. - [x] **Testing:**: Manually verified in a Windows VM that calling `os.unlink(temp_file.name)` before calling `temp_file.close()` causes this error, and that calling `temp_file.close()` before `os.unlink(temp_file.name)` does not. - [x] **Code review:**: OK. - [x] **Prefix:** `fix` # Changelog Entry ### Fixed - Fix "The process cannot access the file because it is being used by another process" issue when adding functions/tools on Windows. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-11 17:58:42 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#8523