Description
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
A RecursionError is encountered when debugging a Python script that includes import openai in PyCharm.
The specific error occurs within the openai library's _utils_proxy.py file, involving the get_proxied and getattr methods.
The error message is as follows:
File "<venv_path>\Lib\site-packages\openai\_utils\_proxy.py", line 45, in __get_proxied__
proxied = self.__proxied
File "<venv_path>\Lib\site-packages\openai\_utils\_proxy.py", line 22, in __getattr__
return getattr(self.__get_proxied__(), attr)
...
RecursionError: maximum recursion depth exceeded
This error is triggered upon initiating the PyCharm debugger to debug the script.
stack trace:
...
getattr, _proxy.py:22
get_proxied, _proxy.py:45
getattr, _proxy.py:22
get_proxied, _proxy.py:45
getattr, _proxy.py:22
get_proxied, _proxy.py:45
class, _proxy.py:39
init, _proxy.py:18
<module>, numpy_proxy.py:29
<module>, init.py:1
<module>, embeddings.py:14
<module>, init.py:20
<module>, _client.py:12
<module>, init.py:11
<module>, temp.py:1
To Reproduce
- In PyCharm, create and open a Python script that imports the OpenAI library (import openai).
- Configure PyCharm for debugging the script.
- Start the debugger in PyCharm. The command executed by PyCharm will be similar to:
<python_executable> -X pycache_prefix=<cache_directory> <pydevd_path> --multiprocess --qt-support --client <client_ip> --port <port> --file test.py
- Observe the RecursionError during the debugging process when the OpenAI library is imported.
PyCharm 2023.3 EAP (Professional Edition)
Code snippets
import openai
print("1")
OS
Windows11
Python version
Python 3.12.0
Library version
1.3.6