fix the write file compatibility on windows platform.
parent
ef9585ce8a
commit
940f1ddebf
|
@ -28,7 +28,7 @@ import asyncio
|
|||
import tornado
|
||||
from tornado.web import Application
|
||||
|
||||
CONST_APP_VERSION = "MaxBot (2023.07.08)"
|
||||
CONST_APP_VERSION = "MaxBot (2023.07.09)"
|
||||
|
||||
CONST_MAXBOT_QUESTION_FILE = "MAXBOT_QUESTION.txt"
|
||||
|
||||
|
@ -227,9 +227,14 @@ def web_server():
|
|||
|
||||
def preview_question_text_file():
|
||||
if os.path.exists(CONST_MAXBOT_QUESTION_FILE):
|
||||
question_text = ""
|
||||
with open(CONST_MAXBOT_QUESTION_FILE, "r") as text_file:
|
||||
question_text = text_file.readline()
|
||||
infile = None
|
||||
if platform.system() == 'Windows':
|
||||
infile = open(CONST_MAXBOT_QUESTION_FILE, 'r', encoding='UTF-8')
|
||||
else:
|
||||
infile = open(CONST_MAXBOT_QUESTION_FILE, 'r')
|
||||
|
||||
if not infile is None:
|
||||
question_text = infile.readline()
|
||||
|
||||
global txt_question
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue