C:\Users\JasonW\AppData\Local\Programs\Python\Python37\python.exe C:\Users\JasonW\PycharmProjects\pythonProject1\ChatGPT.py
Traceback (most recent call last):
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py”, line 700, in urlopen
self._prepare_proxy(conn)
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py”, line 996, in prepare_proxy
conn.connect()
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connection.py”, line 364, in connect
self.sock = conn = self.connect_tls_proxy(hostname, conn)
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connection.py”, line 505, in connect_tls_proxy
ssl_context=ssl_context,
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\util\ssl.py”, line 453, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls)
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\util\ssl.py”, line 495, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\ssl.py”, line 423, in wrap_socket
session=session
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\ssl.py”, line 870, in create
self.do_handshake()
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\ssl.py”, line 1139, in do_handshake
self.sslobj.do_handshake()
OSError: [Errno 0] Error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\adapters.py”, line 499, in send
timeout=timeout,
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py”, line 828, in urlopen
**response_kw
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py”, line 828, in urlopen
**response_kw
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py”, line 788, in urlopen
method, url, error=e, _pool=self, stacktrace=sys.exc_info()[2]
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\util\retry.py”, line 592, in increment
raise MaxRetryError(pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘api.openai.com’, port=443): Max retries exceeded with url: /v1/engines/davinci/completions (Caused by ProxyError(‘Cannot connect to proxy.’, OSError(0, ‘Error’)))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\openai\api_requestor.py”, line 523, in request_raw
timeout=request_timeout if request_timeout else TIMEOUT_SECS,
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\sessions.py”, line 587, in request
resp = self.send(prep, **send_kwargs)
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\sessions.py”, line 701, in send
r = adapter.send(request, **kwargs)
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\adapters.py”, line 559, in send
raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host=‘api.openai.com’, port=443): Max retries exceeded with url: /v1/engines/davinci/completions (Caused by ProxyError(‘Cannot connect to proxy.’, OSError(0, ‘Error’)))
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “C:\Users\JasonW\PycharmProjects\pythonProject1\ChatGPT.py”, line 19, in <module>
generated_text = generate_text(prompt)
File “C:\Users\JasonW\PycharmProjects\pythonProject1\ChatGPT.py”, line 12, in generate_text
temperature=0.5,
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\openai\api_resources\completion.py”, line 25, in create
return super().create(*args, **kwargs)
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py”, line 160, in create
request_timeout=request_timeout,
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\openai\api_requestor.py”, line 224, in request
request_timeout=request_timeout,
File “C:\Users\JasonW\AppData\Local\Programs\Python\Python37\lib\site-packages\openai\api_requestor.py”, line 530, in request_raw
) from e
openai.error.APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool(host=‘api.openai.com’, port=443): Max retries exceeded with url: /v1/engines/davinci/completions (Caused by ProxyError(‘Cannot connect to proxy.’, OSError(0, ‘Error’)))
Process finished with exit code 1
运行后显示 如上,好像与openai api 连接上有问题, 我是用v2ray上的外网