Debugging with PyCharm throws error when environment variable not specified #1426
Closed
1 task done
Labels
bug
Something isn't working
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
Hi OpenAI team!
I'm having trouble debugging my project that uses the
openai
package along with several other dependencies. I'm encountering an exception during the import process.Here is my file
t.py
:Running script in debug mode in PyCharm:
Initially, I attempted to execute uvicorn with FastAPI, but the issue persists even when they are not involved.
Here is traceback:
By the way, the issue doesn't occur if we specify the OPENAI_API_KEY environment variable. However, it's peculiar that simply importing the package initializes a class with side effects, and this only happens in debug mode in PyCharm.
I'm using PyCharm 2023.3.5 (Professional Edition) on macOS Sonoma M1 Pro.
To Reproduce
Described steps above.
Code snippets
No response
OS
macOS
Python version
Python 3.12.3
Library version
openai 1.30.1
The text was updated successfully, but these errors were encountered: