1010from utils .ExcelHelper import ExcelHelper
1111from utils .PDFHelper import PDFHelper
1212from utils .WebHelper import WebHelper
13+ from utils .LogHelper import print_error
1314from config import ProjectInfo , projConfig
1415
1516feedbacktime = projConfig .feedbacktime
@@ -61,7 +62,7 @@ def printSpliter(length=25):
6162 help = 'add --directory or -D specify the save path of pdf file'
6263 'For example, -D ./output. Default path is ./document/pub'
6364 'you can overrider the default path in config.py' ,
64- default = './document/pub' )
65+ default = None )
6566
6667 parser .add_argument ("-p" , "--pmid" , type = str , metavar = '' ,
6768
@@ -88,12 +89,18 @@ def printSpliter(length=25):
8889 # the default pdf saving directory path is from config.py which is './document/pub'
8990 if args .directory is not None :
9091 projConfig .pdfSavePath = args .directory
92+ else :
93+ if projConfig .pdfSavePath is None :
94+ print_error ("Error" "Neither directory of cli nor pdfSavePath in config.py is None." )
95+ print_error ("Please check your config.py and cli parameter." "The program will exit." )
96+ sys .exit ()
9197
9298 if args .keyword .isspace () or args .keyword .isnumeric ():
9399 print ("pubmedsoso search keyword error\n " )
100+ print_error ("the program will exit." )
94101 sleep (feedbacktime )
95-
96-
102+
103+ ######################################################################################################
97104
98105 print (f"Current commandline parameters: { args .__dict__ } \n " )
99106 print (
@@ -116,6 +123,8 @@ def printSpliter(length=25):
116123 sleep (feedbacktime * 0.5 )
117124 sys .exit ()
118125
126+ ######################################################################################################
127+
119128 printSpliter ()
120129 print ("程序已运行,开始检查数据储存目录\n " )
121130 printSpliter ()
0 commit comments