AutoGPT
AutoGPT copied to clipboard
SYSTEM: Command execute_shell returned: Error: 'in <string>' requires string as left operand, not PosixPath
Duplicates
- [X] I have searched the existing issues
Steps to reproduce 🕹
SYSTEM: Command execute_shell returned: Error: 'in
Current behavior 😯
No response
Expected behavior 🤔
No response
Your prompt 📝
# Paste your prompt here
@jonmrjr
can you include the proper steps to reproduce the issue also include complete traceback/error
Attempting to fix JSON by finding outermost brackets
Apparently json was fixed.
NEXT ACTION: COMMAND = execute_shell ARGUMENTS = {'command_line': 'git clone https://github.com/Significant-Gravitas/Auto-GPT.git'}
Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for ...
Input:y
-=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=
SYSTEM: Command execute_shell returned: Error: 'in
I have this error too whenever the AI attempts to create a file. (execute local commands = True in .env)
SYSTEM: Command execute_shell returned: Error: 'in
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/Users/mikea/Auto-GPT/autogpt/logs.py", line 211, in print_assistant_thoughts assistant_reply_json = fix_and_parse_json(assistant_reply) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mikea/Auto-GPT/autogpt/json_fixes/parsing.py", line 107, in fix_and_parse_json return try_ai_fix(try_to_fix_with_gpt, e, json_to_load) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mikea/Auto-GPT/autogpt/json_fixes/parsing.py", line 136, in try_ai_fix ai_fixed_json = fix_json(json_to_load, JSON_SCHEMA) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mikea/Auto-GPT/autogpt/json_fixes/auto_fix.py", line 24, in fix_json function_string, args, description_string, model=cfg.fast_llm_model ^^^ NameError: name 'cfg' is not defined
Attempting to fix JSON by finding outermost brackets Apparently json was fixed. Warning: Failed to parse AI output, attempting to fix. If you see this warning frequently, it's likely that your prompt is confusing the AI. Try changing it up slightly. NEXT ACTION: COMMAND = Error: ARGUMENTS = name 'cfg' is not defined
@Aopenz which branch are you using stable or master?
master @sudouser777
I asked GPT-4 to look at 'execute_code.py' and find the problem. It wasn't very confident in it's answer, but it fixed the issue:
Thank you for providing the full code. The error does not seem to be directly related to the code you provided. There are no PosixPath objects being used in a comparison operation in the code you've shared.
However, there's one thing that can be improved in the code. In the execute_python_file function, when running the code outside of a Docker container, you should use os.path.join() to build the file path passed to the subprocess.run() command. Modify the following line:
python Copy code result = subprocess.run( f"python {file_path}", capture_output=True, encoding="utf8", shell=True ) to:
python Copy code result = subprocess.run( f"python {os.path.join(WORKING_DIRECTORY, file)}", capture_output=True, encoding="utf8", shell=True ) But this change does not seem to be related to the error message you provided earlier. It would be helpful if you could provide the full stack trace of the error message or any additional context where the error is being raised. This would help in identifying the problem and suggesting a solution.
I returned back to the previous version and it rans very well, I don't know what's wrong with this version, not only this error but also the wrong output @nattybones
I returned back to the previous version and it rans very well, I don't know what's wrong with this version, not only this error but also the wrong output @nattybones
what's the git hash of the working version?
we can use git bisect to find and revert the bad commit, most probably
I found it in the recycle, and I don't know exactly which version it is
same here...
NEXT ACTION: COMMAND = execute_shell ARGUMENTS = {'command_line': 'ls workspace/seed_data/ELM327_logs && ls workspace/seed_data/vehicle_data'}
Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for ...
Input:y
-=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=
SYSTEM: Command execute_shell returned: Error: 'in
I think I found the issue here....
File: ./autogpt/commands/execute_code.py Line: 103
if WORKING_DIRECTORY not in current_dir:
The working directory is a PosixPath and needs to be casted to a string...
Change it to
if str(WORKING_DIRECTORY) not in current_dir:
and it should fix it.
Can open a pull request if necessary
Cheers!
thank you all ,its worked
Not sure why i was tagged but score one for humans on this one :)
This issue has automatically been marked as stale because it has not had any activity in the last 50 days. You can unstale it by commenting or removing the label. Otherwise, this issue will be closed in 10 days.
This issue was closed automatically because it has been stale for 10 days with no activity.