Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python-dotenv could not parse statement starting at line ... #2749

Closed
1 task done
qualeo opened this issue Apr 21, 2023 · 13 comments
Closed
1 task done

Python-dotenv could not parse statement starting at line ... #2749

qualeo opened this issue Apr 21, 2023 · 13 comments
Labels
bug Something isn't working needs investigation setup Issues with getting Auto-GPT setup on local machines Stale

Comments

@qualeo
Copy link

qualeo commented Apr 21, 2023

⚠️ Search for existing issues first ⚠️

  • I have searched the existing issues, and there is no existing issue for my problem

Which Operating System are you using?

Linux

GPT-3 or GPT-4?

GPT-4

Steps to reproduce 🕹

Commit Pip Python Python-dotenv
999990b pip 23.0.1 from /usr/lib/python3/dist-packages/pip (python 3.11) Python 3.11.2 python-dotenv, version 1.0.0

Fresh install of stable branch:

git clone https://github.com/Significant-Gravitas/Auto-GPT.git
cd Auto-GPT/
git checkout stable
pip install -r requirements.txt
cp .env.template .env

Uncommented and set OPENAI_API_KEY env var only:

grep -vE '^#|^$' .env 
OPENAI_API_KEY=sk-XXXXXX

Executed init script (see #2689):

./run.sh

Output:

# ...
Requirement already satisfied: distlib<1,>=0.3.6 in /usr/lib/python3/dist-packages (from virtualenv>=20.10.0->pre-commit->-r requirements.txt (line 30)) (0.3.6)
Requirement already satisfied: filelock<4,>=3.4.1 in /usr/lib/python3/dist-packages (from virtualenv>=20.10.0->pre-commit->-r requirements.txt (line 30)) (3.9.0)
Warning: The file 'auto-gpt.json' does not exist. Local memory would not be saved to a file.
Python-dotenv could not parse statement starting at line 61
NEWS:  ::UPDATED:: Welcome to Auto-GPT! We'll keep you informed of the latest news and features by printing messages here. If you don't wish to see this message, you can run Auto-GPT with the --skip-news flag
Welcome to Auto-GPT!  run with '--help' for more information.
Create an AI-Assistant:  Enter the name of your AI and its role below. Entering nothing will load defaults.
Name your AI:  For example, 'Entrepreneur-GPT'
AI Name:

Current behavior 😯

./run.sh outputs Python-dotenv could not parse statement starting at line 61

Expected behavior 🤔

Python-dotenv should parse statement starting at line 61.

python-dotenv --version
python-dotenv, version 1.0.0

python-dotenv --help
Usage: python-dotenv [OPTIONS] COMMAND [ARGS]...

  This script is used to set, get or unset values from a .env file.

Options:
  -f, --file PATH                 Location of the .env file, defaults to .env
                                  file in current working directory.
  -q, --quote [always|never|auto]
                                  Whether to quote or not the variable values.
                                  Default mode is always. This does not affect
                                  parsing.
  -e, --export BOOLEAN            Whether to write the dot file as an
                                  executable bash script.
  --version                       Show the version and exit.
  --help                          Show this message and exit.

Commands:
  get    Retrieve the value for the given key.
  list   Display all the stored key/value.
  run    Run command with environment variables present.
  set    Store the given key/value.
  unset  Removes the given key.

Your prompt 📝

# N/A

Your Logs 📒

2023-04-20 21:36:53,745 INFO NEWS:   ::UPDATED:: Welcome to Auto-GPT! We'll keep you informed of the latest news and features by printing messages here.
If you don't wish to see this message, you can run Auto-GPT with the --skip-news flag
2023-04-20 21:36:54,234 INFO Welcome to Auto-GPT!  run with '--help' for more information.
2023-04-20 21:36:54,454 INFO Create an AI-Assistant: Enter the name of your AI and its role below. Entering nothing will load defaults.
2023-04-20 21:36:54,812 INFO Name your AI:  For example, 'Entrepreneur-GPT'
@Pwuts
Copy link
Member

Pwuts commented Apr 21, 2023

And what's on line 61?

@Pwuts Pwuts added the setup Issues with getting Auto-GPT setup on local machines label Apr 21, 2023
@qualeo
Copy link
Author

qualeo commented Apr 21, 2023

@Pwuts line 61 of what file? It doesn't specify.

@Pwuts
Copy link
Member

Pwuts commented Apr 21, 2023

Line 61 of .env

@qualeo
Copy link
Author

qualeo commented Apr 21, 2023

The .env is not the issue. Even if I reduce it to a single line I receive the same error.

$ cat .env | wc -l
1

@Pwuts
Copy link
Member

Pwuts commented Apr 21, 2023

Does it still complain about line 61 if there is only 1 line?

@qualeo
Copy link
Author

qualeo commented Apr 21, 2023

Does it still complain about line 61 if there is only 1 line?

Yes.

@Pwuts Pwuts added the bug Something isn't working label Apr 21, 2023
@FranMarteen
Copy link

Hi! Gday. Was this issue solved? I am facing the same issue on line 61. Already copied from template again. Auto-gpt is running but I don't what is causing and what functionality may not be workin.

@daefv
Copy link

daefv commented Jul 1, 2023

Python-dotenv could not parse statement starting at line 6
Python-dotenv could not parse statement starting at line 9
Python-dotenv could not parse statement starting at line 12
Python-dotenv could not parse statement starting at line 15
Python-dotenv could not parse statement starting at line 18
Python-dotenv could not parse statement starting at line 21
Python-dotenv could not parse statement starting at line 24
Python-dotenv could not parse statement starting at line 35
Python-dotenv could not parse statement starting at line 38
Python-dotenv could not parse statement starting at line 41
Python-dotenv could not parse statement starting at line 64
Python-dotenv could not parse statement starting at line 67
Python-dotenv could not parse statement starting at line 94
Python-dotenv could not parse statement starting at line 97
Python-dotenv could not parse statement starting at line 120
Python-dotenv could not parse statement starting at line 123
Python-dotenv could not parse statement starting at line 126
Python-dotenv could not parse statement starting at line 128
Python-dotenv could not parse statement starting at line 131
Python-dotenv could not parse statement starting at line 134
Python-dotenv could not parse statement starting at line 146
Python-dotenv could not parse statement starting at line 149
Python-dotenv could not parse statement starting at line 156
Python-dotenv could not parse statement starting at line 159
Python-dotenv could not parse statement starting at line 166
Python-dotenv could not parse statement starting at line 169
Python-dotenv could not parse statement starting at line 172
Python-dotenv could not parse statement starting at line 175
Python-dotenv could not parse statement starting at line 178
Python-dotenv could not parse statement starting at line 197
Python-dotenv could not parse statement starting at line 199
Python-dotenv could not parse statement starting at line 207

@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

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 github-actions bot added the Stale label Sep 6, 2023
@github-actions
Copy link
Contributor

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

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 17, 2023
@luckman212
Copy link

@daefv I had the same issue, eventually figured out that it's because I had an .env file in my $HOME directory (for Bash env vars) and Python-dotenv was trying to parse this. I renamed this file and the errors disappeared.

@DonRichards
Copy link

Thanks @luckman212 Error in my ~/.env file was the issue. I didn't realize python-dotenv would traverse up to the ~/ directory and load all of the .env files it found along the way.

@luckman212
Copy link

Apparently another workaround could be:

export SKIP_PYTHONDOTENV=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigation setup Issues with getting Auto-GPT setup on local machines Stale
Projects
None yet
Development

No branches or pull requests

6 participants