From 1e8e71689d7557f7f603150dfbaeb7e6624194b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=A3=E6=A9=99?= <2625835752@qq.com> Date: Fri, 20 May 2022 11:09:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BC=82=E5=B8=B8=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 电脑名中包含中文名时不能正常启动flask后台 --- backend/backend.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/backend.py b/backend/backend.py index 218e34f..0797495 100644 --- a/backend/backend.py +++ b/backend/backend.py @@ -39,5 +39,11 @@ def hello_world(): if __name__ == '__main__': - app.run(port=8000) - # app.run(host="0.0.0.0", port=80) + try: + app.run(port=8000) + # app.run(host="0.0.0.0", port=80) + except UnicodeDecodeError: + print("非常抱歉,您的电脑名中包含ASCII码不能解析的字符(例如中文字符),请在“控制面板-系统-关于”中修改电脑名为纯英文后重试。因为需要在本机开启后台,为您带来的不便,还请谅解!") + except: + import traceback + print(traceback.format_exc()) \ No newline at end of file