Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process #4800

Closed
zhenjiaguo opened this issue Jun 13, 2023 · 1 comment

Comments

@zhenjiaguo
Copy link
Contributor

我在运行 PNNX.exe 转换后的 yolov8n_pnnx.py 文件时,遇到一个错误:

error log | 日志或报错信息 | ログ

E       PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\jia\\AppData\\Local\\Temp\\tmp8ynogw65'

yolov8n_pnnx.py:282: PermissionError

context | 编译/运行环境 | バックグラウンド

系统:windows11

how to reproduce | 复现步骤 | 再現方法

  1. 在 win11 系统上运行pnnx 转换生成后的 *_pnnx.py 文件

more | 其他 | その他

经研究发现是该文件的 fd 没有正常关闭之前就被删除,所以程序报错了。tempfile.mkstemp()会返回 (fd, name),在删除tmp文件之前应该使用 os.close(fd) 才不会报错。

而且我觉得有更好的写法,详见PR。

@nihui
Copy link
Member

nihui commented Jun 14, 2023

感谢反馈和修复!

@nihui nihui closed this as completed Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants