FolderCreateTool
Creates a folder, ignores if it exists.
Parameters
folder
(str): The path to the folder to be created.
Returns
The return value is of the type: ToolReturn
(Learn more about:
ToolReturn) with the following output and
exit_code:
output
(None): None.exit_code
(int): 0 if success, 1 if failure.
Usage
(Learn more about: FileFolderExistsTool)
import asyncio
from embedia.tools import FolderCreateTool, FileFolderExistsTool
folder_create = FolderCreateTool()
folder_exists = FileFolderExistsTool()
asyncio.run(folder_create(folder="temp"))
resp = asyncio.run(folder_exists(path="temp"))
print("Does temp folder exist?", resp.output)
Running the above code prints the following:
[time: 2023-10-03T15:18:26.719010+00:00] [id: 139814915043408] [event: Tool Start]
Tool: FolderCreateTool
Args: ()
Kwargs: {'folder': 'temp'}
[time: 2023-10-03T15:18:26.719140+00:00] [id: 139814915043408] [event: Tool End]
Tool: FolderCreateTool
ExitCode: 0
Output:
None
[time: 2023-10-03T15:18:26.720125+00:00] [id: 139814915043152] [event: Tool Start]
Tool: FileFolderExistsTool
Args: ()
Kwargs: {'path': 'temp'}
[time: 2023-10-03T15:18:26.720193+00:00] [id: 139814915043152] [event: Tool End]
Tool: FileFolderExistsTool
ExitCode: 0
Output:
True
Does temp folder exist? True