yihong0618 / bilingual_book_maker

Make bilingual epub books Using AI translate
MIT License
7.67k stars 1.07k forks source link

翻到一半出錯誤停了,但沒有把resume產出來 #189

Open orocannoneer opened 1 year ago

orocannoneer commented 1 year ago
「私は未来の存在だから、当然君は私を知らない。そのせいか、若返った以外はだいたい生前どおりだと思う」「ランサーは違うってわけね」
Request timed out: HTTPSConnectionPool(host='api.openai.com', port=443): Read timed out. (read timeout=600) will sleep 60 seconds
Error communicating with OpenAI: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) will sleep 60 seconds
Error communicating with OpenAI: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) will sleep 60 seconds
Get 3 consecutive exceptions
Error communicating with OpenAI: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Something is wrong when translate
you can resume it next time
Traceback (most recent call last):
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
                       ^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 1374, in getresponse
    response.begin()
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 318, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 287, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\adapters.py", line 489, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\packages\six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
                       ^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 1374, in getresponse
    response.begin()
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 318, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 287, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\openai\api_requestor.py", line 516, in request_raw
    result = _thread_context.session.request(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\adapters.py", line 547, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\ff760\bilingual_book_maker\book_maker\loader\txt_loader.py", line 72, in make_bilingual_book
    temp = self.translate_model.translate(batch_text)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\bilingual_book_maker\book_maker\translator\chatgptapi_translator.py", line 120, in translate
    t_text = self.get_translation(text)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\bilingual_book_maker\book_maker\translator\chatgptapi_translator.py", line 72, in get_translation
    completion = self.create_chat_completion(text)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\bilingual_book_maker\book_maker\translator\chatgptapi_translator.py", line 62, in create_chat_completion
    return openai.ChatCompletion.create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\openai\api_resources\chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
                           ^^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\openai\api_requestor.py", line 216, in request
    result = self.request_raw(
             ^^^^^^^^^^^^^^^^^
  File "C:\Users\ff760\AppData\Local\Programs\Python\Python311\Lib\site-packages\openai\api_requestor.py", line 528, in request_raw
    raise error.APIConnectionError(
openai.error.APIConnectionError: Error communicating with OpenAI: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ff760\bilingual_book_maker\book_maker\loader\txt_loader.py", line 75, in make_bilingual_book
    raise Exception("Something is wrong when translate")
Exception: Something is wrong when translate

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ff760\bilingual_book_maker\book_maker\loader\txt_loader.py", line 119, in _save_progress
    f.write("\n".join(self.p_to_save))
UnicodeEncodeError: 'cp950' codec can't encode character '\u65e0' in position 4: illegal multibyte sequence

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ff760\bilingual_book_maker\make_book.py", line 4, in <module>
    main()
  File "C:\Users\ff760\bilingual_book_maker\book_maker\cli.py", line 273, in main
    e.make_bilingual_book()
  File "C:\Users\ff760\bilingual_book_maker\book_maker\loader\txt_loader.py", line 91, in make_bilingual_book
    self._save_progress()
  File "C:\Users\ff760\bilingual_book_maker\book_maker\loader\txt_loader.py", line 121, in _save_progress
    raise Exception("can not save resume file")
Exception: can not save resume file

C:\Users\ff760\bilingual_book_maker>
yihong0618 commented 1 year ago

看看是否生成了 temp file 我白天在外面,晚上看看哈

orocannoneer commented 1 year ago

看看是否生成了 temp file 我白天在外面,晚上看看哈

只有一個0位元組的.Fate.temp.bin,我丟進去餵的檔案是Fate.txt