Update file_operations.py

Introduces spaces between code blocks.
This commit is contained in:
Andres Caicedo
2023-04-04 11:32:55 +02:00
parent d450ac3a0b
commit 1d10236a63

View File

@@ -3,6 +3,7 @@ import os.path
# Set a dedicated folder for file I/O
working_directory = "auto_gpt_workspace"
# Create the directory if it doesn't exist
if not os.path.exists(working_directory):
os.makedirs(working_directory)
@@ -35,8 +36,10 @@ def write_to_file(filename, text):
try:
filepath = safe_join(working_directory, filename)
directory = os.path.dirname(filepath)
if not os.path.exists(directory):
os.makedirs(directory)
with open(filepath, "w") as f:
f.write(text)
return "File written to successfully."