Skip to content

ConnectTimeout #15

@BrainBlairfrist

Description

@BrainBlairfrist

When the python3 server.py command is executed, the following error is displayed. openai has changed its access mode, can you modify it.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/h11_impl.py", line 406, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py", line 70, in call
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/applications.py", line 113, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 187, in call
raise exc
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 165, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 62, in wrapped_app
raise exc
File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 51, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 715, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 735, in app
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 62, in wrapped_app
raise exc
File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 51, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 73, in app
response = await f(request)
File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 297, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 210, in run_endpoint_function
return await dependant.call(**values)
File "/mnt/e/pdf_translator-main/server.py", line 91, in translate_pdf
self._translate_pdf(input_pdf_data, self.temp_dir_name, from_lang, to_lang, p_from, p_to, side_by_side)
File "/mnt/e/pdf_translator-main/server.py", line 142, in _translate_pdf
result = translator.translate_all(result, from_lang, to_lang)
File "/mnt/e/pdf_translator-main/modules/translate/base.py", line 15, in translate_all
line.translated_text = self.translate(line.text, from_lang, to_lang)
File "/mnt/e/pdf_translator-main/modules/translate/openai_gpt.py", line 105, in translate
response = self.client.chat.completions.create(
File "/usr/local/lib/python3.10/dist-packages/openai/_utils/_utils.py", line 274, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/openai/resources/chat/completions.py", line 668, in create
return self._post(
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1260, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 937, in request
return self._request(
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 997, in _request
return self._retry_request(
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1075, in _retry_request
return self._request(
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 997, in _request
return self._retry_request(
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1075, in _retry_request
return self._request(
File "/usr/local/lib/python3.10/dist-packages/openai/_base_client.py", line 1007, in _request
raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions