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

.env not found in current directory #13

Closed
juananpe opened this issue Jul 17, 2023 · 1 comment · Fixed by #14
Closed

.env not found in current directory #13

juananpe opened this issue Jul 17, 2023 · 1 comment · Fixed by #14
Labels
question Further information is requested

Comments

@juananpe
Copy link
Contributor

I suggest to replace this line:

with

load_dotenv(dotenv_path="./.env")

so the .env file is located in the current directory of the Python script.

For instance:

 juanan@u033782  /opt/codeinterpreter-api-test  tree -a                                 
.
├── .codebox
├── .env
└── get_btc.py

without that change, if we run the get_btc.py script we'll get this error:

File "/Users/juanan/.pyenv/versions/3.10.0/lib/python3.10/site-packages/codeinterpreterapi/session.py", line 54, in _llm
raise ValueError("OpenAI API key missing.")
ValueError: OpenAI API key missing.

With the suggested change, the .env file will be correctly located.

@shroominic
Copy link
Owner

I am not sure if this is nessesary. I have the .env file in the same location as you and for me it works.
As far as I know dotenv is searching the entire directory tree from the current working directory down the folders for a .env file so by default it should find it.

@shroominic shroominic added the question Further information is requested label Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants