Skip to content

pdf2zh.exe无法打开 #977

@Agnon1573

Description

@Agnon1573

在提问之前...

  • 我已经搜索了现有的 issues
  • 我在提问题之前至少花费了 5 分钟来思考和准备
  • 我已经认真且完整的阅读了 wiki
  • 我已经认真检查了问题和网络环境无关(包括但不限于Google不可用,模型下载失败)

使用的环境

window10
pdf2zh-v1.9.9-win64
使用的windows安装包

请选择安装方式

exe

描述你的问题

打开pdf2zh报错
1、已安装vc_redist.x64
2、尝试增加了环境set HF_ENDPOINT=https://hf-mirror.com
3、重启后重试还是报错
not in git repo
[06/05/25 21:42:57] INFO INFO:babeldoc.assets.assets:doclayout onnx model not found or corrupted, assets.py:196 downloading...
[06/05/25 21:43:01] WARNING WARNING:babeldoc.assets.assets:Network error occurred: [SSL: assets.py:66 CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate
in certificate chain (_ssl.c:1010), will retry
WARNING WARNING:babeldoc.assets.assets:Get font metadata failed, retrying in 1.0 assets.py:118 seconds... (Attempt 1/3)
[06/05/25 21:43:03] WARNING WARNING:babeldoc.assets.assets:Network error occurred: [SSL: assets.py:66 CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate
in certificate chain (_ssl.c:1010), will retry
WARNING WARNING:babeldoc.assets.assets:Download file failed, retrying in 1.0 assets.py:89 seconds... (Attempt 1/3)
[06/05/25 21:43:06] WARNING WARNING:babeldoc.assets.assets:Network error occurred: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1010), will retry assets.py:66 WARNING WARNING:babeldoc.assets.assets:Download file failed, retrying in 2.0 seconds... (Attempt 2/3) assets.py:89
[06/05/25 21:43:10] WARNING WARNING:babeldoc.assets.assets:Network error occurred: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed assets.py:66 certificate in certificate chain (_ssl.c:1010), will retry
Exception in thread Thread-1 (_wrapper):
Traceback (most recent call last):
File "D:\software\pdf2zh\build\site-packages\httpx_transports\default.py", line 101, in map_httpcore_exceptions
yield
File "D:\software\pdf2zh\build\site-packages\httpx_transports\default.py", line 394, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\httpcore_async\connection_pool.py", line 256, in handle_async_request
raise exc from None
File "D:\software\pdf2zh\build\site-packages\httpcore_async\connection_pool.py", line 236, in handle_async_request
response = await connection.handle_async_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\httpcore_async\http_proxy.py", line 316, in handle_async_request
stream = await stream.start_tls(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\httpcore_async\http11.py", line 376, in start_tls
return await self._stream.start_tls(ssl_context, server_hostname, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\httpcore_backends\anyio.py", line 67, in start_tls
with map_exceptions(exc_map):
^^^^^^^^^^^^^^^^^^^^^^^
File "contextlib.py", line 158, in exit
File "D:\software\pdf2zh\build\site-packages\httpcore_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1010)

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

Traceback (most recent call last):
File "D:\software\pdf2zh\build\site-packages\tenacity\asyncio_init_.py", line 114, in call
result = await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\babeldoc\assets\assets.py", line 102, in download_file
response = await client.get(url, follow_redirects=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\httpx_client.py", line 1768, in get
return await self.request(
^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\httpx_client.py", line 1540, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\httpx_client.py", line 1629, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\httpx_client.py", line 1657, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\httpx_client.py", line 1694, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\httpx_client.py", line 1730, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\httpx_transports\default.py", line 393, in handle_async_request
with map_httpcore_exceptions():
^^^^^^^^^^^^^^^^^^^^^^^^^
File "contextlib.py", line 158, in exit
File "D:\software\pdf2zh\build\site-packages\httpx_transports\default.py", line 118, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1010)

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

Traceback (most recent call last):
File "threading.py", line 1075, in bootstrap_inner
File "threading.py", line 1012, in run
File "D:\software\pdf2zh\build\site-packages\babeldoc\assets\assets.py", line 42, in wrapper
result_container.set_result(asyncio.run(coro))
^^^^^^^^^^^^^^^^^
File "asyncio\runners.py", line 195, in run
File "asyncio\runners.py", line 118, in run
File "asyncio\base_events.py", line 691, in run_until_complete
File "D:\software\pdf2zh\build\site-packages\babeldoc\assets\assets.py", line 204, in get_doclayout_onnx_model_path_async
await download_file(
File "D:\software\pdf2zh\build\site-packages\tenacity\asyncio_init
.py", line 189, in async_wrapped
return await copy(fn, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\tenacity\asyncio_init
.py", line 111, in call
do = await self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\tenacity\asyncio_init_.py", line 153, in iter
result = await action(retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\tenacity_utils.py", line 99, in inner
return call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\tenacity_init_.py", line 421, in exc_check
raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x2533dbc8830 state=finished raised ConnectError>]
Traceback (most recent call last):
File "D:\software\pdf2zh\build_pystand_static.int", line 19, in
code = pdf2zh.pdf2zh.main()
^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\pdf2zh\pdf2zh.py", line 272, in main
ModelInstance.value = OnnxModel.load_available()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\pdf2zh\doclayout.py", line 33, in load_available
return DocLayoutModel.load_onnx()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\pdf2zh\doclayout.py", line 28, in load_onnx
model = OnnxModel.from_pretrained()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\pdf2zh\doclayout.py", line 86, in from_pretrained
return OnnxModel(pth)
^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\pdf2zh\doclayout.py", line 76, in init
model = onnx.load(model_path)
^^^^^^^^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\onnx_init_.py", line 212, in load_model
model = _get_serializer(format, f).deserialize_proto(load_bytes(f), ModelProto())
^^^^^^^^^^^^^^
File "D:\software\pdf2zh\build\site-packages\onnx_init
.py", line 149, in _load_bytes
with open(f, "rb") as readable:
^^^^^^^^^^^^^
TypeError: expected str, bytes or os.PathLike object, not NoneType
Press Enter to continue...

如何复现

  1. 执行 '...'
  2. 选择 '....'
  3. 出现问题

预期行为

No response

相关 Logs


原始PDF文件

No response

还有别的吗?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions