Closed VirtualZardoz closed 6 months ago
Found the problem. I need to modify the code so it can handle windows file paths. Here is the modified code:
# Check if the input contains a file path
if "\\" in objective or "/" in objective:
# Extract the file path from the objective
#file_path = re.findall(r'[./\w\s]+\.[\w]+', objective)[0] -> Original code
file_path = re.findall(r'[a-zA-Z]:\\(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]*', objective)[0]
# Read the file content
with open(file_path, 'r') as file:
file_content = file.read()
# Update the objective string to remove the file path
objective = objective.split(file_path)[0].strip()
else:
file_content = None
This issue arises in all 5 maestro scripts on my Windows 11 machine. The scripts cannot read the file and then, depending on which script, either take on the task to develop a Python script to read the file, or use a "made up" file content to illustrate what they would have done if there were any content. The file content was: "What is the capital of France?".