Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

部分文件中使用 try_import 的方法似乎有误 #11808

Closed
neteroster opened this issue Mar 26, 2024 · 2 comments
Closed

部分文件中使用 try_import 的方法似乎有误 #11808

neteroster opened this issue Mar 26, 2024 · 2 comments
Assignees
Labels
bug Something isn't working status/close

Comments

@neteroster
Copy link
Contributor

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

  • 系统环境/System Environment:/
  • 版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components:/
  • 运行指令/Command Code:/
  • 完整报错/Complete Error Message:/

请尽量不要包含图片在问题中/Please try to not include the image in the issue.

如题,例如

try_import('fitz')

又如

try_import('fitz')

try_import 的源码应该在

https://github.com/PaddlePaddle/Paddle/blob/89a60d773893640b7cec91d4857d634a61b02304/python/paddle/utils/lazy_import.py#L21

根据我的理解,应该要这样写:

fitz = try_import('fitz')

我确实也在实际使用的时候看到了错误:

[2024/03/26 07:26:09] ppocr INFO: **********./C017.pdf**********
Traceback (most recent call last):
  File "/usr/local/bin/paddleocr", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/paddleocr/paddleocr.py", line 807, in main
    img, flag_gif, flag_pdf = check_and_read(img_path)
  File "/usr/local/lib/python3.10/dist-packages/paddleocr/ppocr/utils/utility.py", line 114, in check_and_read
    with fitz.open(img_path) as pdf:
NameError: name 'fitz' is not defined
@TingquanGao
Copy link
Collaborator

感谢反馈~ 欢迎提PR修复此问题,或者我们之后来修复。

@TingquanGao TingquanGao added the bug Something isn't working label Mar 27, 2024
@jzhang533
Copy link
Collaborator

you are correct, please feel free to create a PR.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 11, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Something isn't working status/close
Projects
None yet
Development

No branches or pull requests

3 participants