settings file not found

parent 91655377
...@@ -21,6 +21,9 @@ def main(argv): ...@@ -21,6 +21,9 @@ def main(argv):
with open(rootdir+"/"+datetime.datetime.today().strftime('%Y-%m-%d')+".log", "a") as logfile: with open(rootdir+"/"+datetime.datetime.today().strftime('%Y-%m-%d')+".log", "a") as logfile:
for path in glob.glob(f'{rootdir}/*/'): for path in glob.glob(f'{rootdir}/*/'):
if not os.path.exists((path+'settings.json'):
ogfile.write("\t configuration file not found.\n")
continue
with open(path+'settings.json') as json_file: with open(path+'settings.json') as json_file:
cfg = json.load(json_file) cfg = json.load(json_file)
logfile.write("Crawler "+cfg["crawler"]+" started at: " +datetime.datetime.now().strftime("%Y-%m-%d, %H:%M:%S")+"\n") logfile.write("Crawler "+cfg["crawler"]+" started at: " +datetime.datetime.now().strftime("%Y-%m-%d, %H:%M:%S")+"\n")
...@@ -32,8 +35,6 @@ def main(argv): ...@@ -32,8 +35,6 @@ def main(argv):
else: else:
logfile.write("\t spider not found.\n") logfile.write("\t spider not found.\n")
print(os.getcwd()) print(os.getcwd())
os.chdir(cwd) os.chdir(cwd)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
if __name__ == "__main__": if __name__ == "__main__":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment