From 47e80da1f855e265aa9a350f02bc073e2e7a05df Mon Sep 17 00:00:00 2001 From: abdo Date: Mon, 29 Mar 2021 07:37:03 +0300 Subject: [PATCH] Fix ResourceWarning in openFolder() on Windows subprocess.Popen emits ResourceWarning in the destructor if the status of the process was not read. Fix by using subprocess.run() instead, which takes care of that. Using run() is also recommended for simple cases like this in the docs. --- qt/aqt/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt/aqt/utils.py b/qt/aqt/utils.py index 44416a0ee..2b4a0511d 100644 --- a/qt/aqt/utils.py +++ b/qt/aqt/utils.py @@ -688,7 +688,7 @@ def mungeQA(col: Collection, txt: str) -> str: def openFolder(path: str) -> None: if isWin: - subprocess.Popen(["explorer", f"file://{path}"]) + subprocess.run(["explorer", f"file://{path}"], check=False) else: with noBundledLibs(): QDesktopServices.openUrl(QUrl(f"file://{path}"))