MCPcopy Create free account
hub / github.com/a943512/PyAibote / WriteFileAddTo

Method WriteFileAddTo

PyAibote/Tool/WriteReadFileFunc.py:53–73  ·  view source on GitHub ↗

追加写入文件 Additional write file path: 需要追加写入的文件路径 data: 需要追加写入的数据 return: 成功返回True, 失败返回False path: the file path that needs additional writing data: data that needs to be written additionally return: fil

(self,path,data)

Source from the content-addressed store, hash-verified

51 return False
52
53 def WriteFileAddTo(self,path,data) -> bool:
54 """
55 追加写入文件
56 Additional write file
57
58 path: 需要追加写入的文件路径
59 data: 需要追加写入的数据
60 return: 成功返回True, 失败返回False
61
62 path: the file path that needs additional writing
63 data: data that needs to be written additionally
64 return: file data is returned successfully, and False is returned if it fails
65 """
66
67 try:
68 with open(path,'a',encoding='UTF-8') as w:
69 w.write(data)
70 return True
71 except Exception as e:
72 WriteReadFile.Custom_Write_logger(self,"",f"{os.getcwd()}/AiBotRunLOG/{time.strftime(r'%Y-%m-%d',time.localtime(time.time()))}/","SysModeError.log",False,"error",f"{traceback.format_exc()}")
73 return False
74
75 def ReadJsonFile(self, path, key=None, Key2=None, Key3=None, Key4=None, Key5=None) -> str or bool:
76 """

Callers

nothing calls this directly

Calls 1

Custom_Write_loggerMethod · 0.80

Tested by

no test coverage detected