Significant-Gravitas / AutoGPT

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
https://agpt.co
MIT License
166.55k stars 44.08k forks source link

Cannot read relative path file #4366

Closed RuiHirano closed 1 year ago

RuiHirano commented 1 year ago

⚠️ Search for existing issues first ⚠️

Which Operating System are you using?

Docker

Which version of Auto-GPT are you using?

Latest Release

Do you use OpenAI GPT-3 or GPT-4?

GPT-3.5

Which area covers your issue best?

Commands

Describe your issue.

Thanks for the great library. I am running prompts on stock prices in AutoGPT. In the middle of the task, AutoGPT write code to read a file, but if the path specification is relative, an error occurs and the file cannot be read.

What could be the cause?

auto_gpt_workspace folder

auto_gpt_workspace/data.csv

Date,Open,High,Low,Close,Volume
2022-01-01,1.2345,1.2456,1.2300,1.2400,10000
2022-01-02,1.2400,1.2500,1.2350,1.2450,15000
2022-01-03,1.2450,1.2550,1.2400,1.2500,20000
2022-01-04,1.2500,1.2600,1.2450,1.2550,25000
2022-01-05,1.2550,1.2650,1.2500,1.2600,30000
2022-01-06,1.2600,1.2700,1.2550,1.2650,35000
2022-01-07,1.2650,1.2750,1.2600,1.2700,40000
2022-01-08,1.2700,1.2800,1.2650,1.2750,45000
2022-01-09,1.2750,1.2850,1.2700,1.2800,50000
2022-01-10,1.2800,1.2900,1.2750,1.2850,55000

auto_gpt_workspace/backtest.py

import pandas as pd
import numpy as np

# Load data
data = pd.read_csv('data.csv')

Action

NEXT ACTION:  COMMAND = execute_python_file ARGUMENTS = {'filename': '/app/autogpt/auto_gpt_workspace/backtest.py'}
AUTHORISED COMMANDS LEFT: 7 

Output

NEXT ACTION:  COMMAND = execute_python_file ARGUMENTS = {'filename': '/app/autogpt/auto_gpt_workspace/backtest.py'}
AUTHORISED COMMANDS LEFT: 7 
  Executing file '/app/autogpt/auto_gpt_workspace/backtest.py'
SYSTEM:  Command execute_python_file returned: Error: Traceback (most recent call last): File "/app/autogpt/auto_gpt_workspace/backtest.py", line 5, in <module> data = pd.read_csv('data.csv') File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 912, in read_csv return _read(filepath_or_buffer, kwds) File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 577, in _read parser = TextFileReader(filepath_or_buffer, **kwds) File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 1407, in __init__ self._engine = self._make_engine(f, self.engine) File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 1661, in _make_engine self.handles = get_handle( File "/usr/local/lib/python3.10/site-packages/pandas/io/common.py", line 859, in get_handle handle = open( FileNotFoundError: [Errno 2] No such file or directory: 'data.csv'

Upload Activity Log Content

NEXT ACTION: COMMAND = execute_python_file ARGUMENTS = {'filename': '/app/autogpt/auto_gpt_workspace/backtest.py'} AUTHORISED COMMANDS LEFT: 7

Upload Error Log Content

Command execute_python_file returned: Error: Traceback (most recent call last): File "/app/autogpt/auto_gpt_workspace/backtest.py", line 5, in data = pd.read_csv('data.csv') File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 912, in read_csv return _read(filepath_or_buffer, kwds) File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 577, in _read parser = TextFileReader(filepath_or_buffer, **kwds) File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 1407, in init self._engine = self._make_engine(f, self.engine) File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 1661, in _make_engine self.handles = get_handle( File "/usr/local/lib/python3.10/site-packages/pandas/io/common.py", line 859, in get_handle handle = open( FileNotFoundError: [Errno 2] No such file or directory: 'data.csv'

W3Warp commented 1 year ago

are you on the latest master branch? if not you can try that It worked for me

KaiwenYu2001 commented 1 year ago

Same issue with docker in MACos, have you solved the problem?

github-actions[bot] commented 1 year ago

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.

github-actions[bot] commented 1 year ago

This issue was closed automatically because it has been stale for 10 days with no activity.