From ef8c22e2ed65ef55746ca042f2ae0446fbf3768d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Tue, 29 Oct 2024 15:55:01 +0800 Subject: [PATCH] fix filenotfounderror --- PyStand.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/PyStand.cpp b/PyStand.cpp index 9cd4bd9..6400f8f 100644 --- a/PyStand.cpp +++ b/PyStand.cpp @@ -345,10 +345,13 @@ const char *init_script = " sys.stderr = fp\n" " attached = True\n" "except Exception as e:\n" -" fp = open(os.devnull, 'w', errors='ignore')\n" -" sys.stdout = fp\n" -" sys.stderr = fp\n" -" attached = False\n" +" try:\n" +" fp = open(os.devnull, 'w', errors='ignore')\n" +" sys.stdout = fp\n" +" sys.stderr = fp\n" +" attached = False\n" +" except:\n" +" pass\n" #endif "for n in ['.', 'lib', 'site-packages', 'runtime']:\n" " test = os.path.abspath(os.path.join(PYSTAND_HOME, n))\n"