From eebe92bab09312158d99fa5868171fb8ce4663fd Mon Sep 17 00:00:00 2001 From: flt6 <1404262047@qq.com> Date: Wed, 9 Jul 2025 00:14:59 +0800 Subject: [PATCH] fix no rich --- main.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index 3251a5b..82ecb09 100644 --- a/main.py +++ b/main.py @@ -13,6 +13,13 @@ from typing import Callable, List, Optional import pandas as pd +try: + from rich.markdown import Markdown + from rich import print + RICH = True +except ImportError: + print("Some function in console may disabled due to no rich.") + RICH = False class Lessons(URP): def __init__(self): @@ -412,12 +419,9 @@ class Grade(URP): t = "\n".join(t) sc_send("成绩发布",t) - try: - from rich.markdown import Markdown - from rich import print + if RICH: print(Markdown(t)) - except ImportError: - print("Cannot import rich, show markdown directly.") + else: print(t) grades = new if err > 0: err-=1 @@ -441,7 +445,7 @@ class Grade(URP): if __name__ == "__main__": - les = Lessons() - les.auto_spider() - # gra = Grade() - # gra.auto_check() \ No newline at end of file + # les = Lessons() + # les.auto_spider() + gra = Grade() + gra.auto_check() \ No newline at end of file