fix no rich
This commit is contained in:
22
main.py
22
main.py
@ -13,6 +13,13 @@ from typing import Callable, List, Optional
|
|||||||
|
|
||||||
import pandas as pd
|
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):
|
class Lessons(URP):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -412,12 +419,9 @@ class Grade(URP):
|
|||||||
|
|
||||||
t = "\n".join(t)
|
t = "\n".join(t)
|
||||||
sc_send("成绩发布",t)
|
sc_send("成绩发布",t)
|
||||||
try:
|
if RICH:
|
||||||
from rich.markdown import Markdown
|
|
||||||
from rich import print
|
|
||||||
print(Markdown(t))
|
print(Markdown(t))
|
||||||
except ImportError:
|
else:
|
||||||
print("Cannot import rich, show markdown directly.")
|
|
||||||
print(t)
|
print(t)
|
||||||
grades = new
|
grades = new
|
||||||
if err > 0: err-=1
|
if err > 0: err-=1
|
||||||
@ -441,7 +445,7 @@ class Grade(URP):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
les = Lessons()
|
# les = Lessons()
|
||||||
les.auto_spider()
|
# les.auto_spider()
|
||||||
# gra = Grade()
|
gra = Grade()
|
||||||
# gra.auto_check()
|
gra.auto_check()
|
Reference in New Issue
Block a user