AutoGPT: NameError: name 'cfg' is not defined
Duplicates
- I have searched the existing issues
Steps to reproduce 🕹
Version:
master ee8276c Merge pull request #615 from openaudible/patch-1
Trying to run the program:
(base) D:\GPT\Auto-GPT>python scripts\main.py
Traceback (most recent call last):
File "D:\GPT\Auto-GPT\scripts\main.py", line 290, in <module>
check_openai_api_key()
File "D:\GPT\Auto-GPT\scripts\main.py", line 22, in check_openai_api_key
if not cfg.openai_api_key:
NameError: name 'cfg' is not defined
(base) D:\GPT\Auto-GPT>
File: .env
#PINECONE_API_KEY=your-pinecone-api-key
#PINECONE_ENV=your-pinecone-region
OPENAI_API_KEY="XXXXXXXXXX Edited XXXXXXXXXXXXXXXXXXXX"
#ELEVENLABS_API_KEY=your-elevenlabs-api-key
SMART_LLM_MODEL="gpt-4"
FAST_LLM_MODEL="gpt-3.5-turbo"
#GOOGLE_API_KEY=
#CUSTOM_SEARCH_ENGINE_ID=
USE_AZURE=False
#OPENAI_API_BASE=your-base-url-for-azure
#OPENAI_API_VERSION=api-version-for-azure
#OPENAI_DEPLOYMENT_ID=deployment-id-for-azure
Current behavior 😯
Errors out.
Expected behavior 🤔
It should run normally
Your prompt 📝
(base) D:\GPT\Auto-GPT>python scripts\main.py
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (4 by maintainers)
Commits related to this issue
- Re-order cfg declaration before utilizing it Ref #672 the program currently crashes on launch when attempting to call cfg before the variable is declared. Initializing it before running the check_ope... — committed to PanRagon/Auto-GPT by PanRagon a year ago
- Update Research.md (#672) * Update Research.md Update Research.md * Update website/docs/Research.md Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * Update Research.md Co-authored-by:... — committed to SquareandCompass/Auto-GPT by liususan091219 2 years ago
In
scripts/memory/base.py
declare after the imports:cfg = Config()
Switched order of lines 291/292 and works for me:
@erni-tf thanks, that worked. The next error is:
Same issue.
Having the same issue
while #669 and #670 Do mention the issue. I would argue that this issue follows the issue template best and should be the issue to handle this