renoyuan / easyofd

use python parse OFD file: finished ofd2img ofd2pdf pdf2ofd img2ofd ;(纯 python的ofd解析与pdf转换)
Apache License 2.0
210 stars 28 forks source link

Linux系统报错TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' #18

Open HI406 opened 4 months ago

HI406 commented 4 months ago

运行Demo文件就报错了 刚开始是报错缺字体,我在/usr/share/fonts目录下创建了myfonts文件夹,复制进去simsun.ttc、COURI.TTF和STKAITI.TTF三个字体后,再运行就报这个错误: :~$ python3 '/home/gxxc/Downloads/demo.py'

/home/easyofd
/home
Traceback (most recent call last):
  File "/home/gxxc/Downloads/demo.py", line 20, in <module>
    from easyofd.ofd import OFD
  File "/home/gxxc/.local/lib/python3.9/site-packages/easyofd/__init__.py", line 1, in <module>
    from .ofd import OFD
  File "/home/gxxc/.local/lib/python3.9/site-packages/easyofd/ofd.py", line 22, in <module>
    from easyofd.draw import DrawPDF,OFDWrite
  File "/home/gxxc/.local/lib/python3.9/site-packages/easyofd/draw/__init__.py", line 14, in <module>
    from .draw_ofd import OFDWrite
  File "/home/gxxc/.local/lib/python3.9/site-packages/easyofd/draw/draw_ofd.py", line 21, in <module>
    class OFDWrite(object):
  File "/home/gxxc/.local/lib/python3.9/site-packages/easyofd/draw/draw_ofd.py", line 53, in OFDWrite
    def build_document_res(self, img_len: int = 0, id_obj: CurId = None, pfd_res_uuid_map: [dict|None]=None):
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
renoyuan commented 4 months ago

Linux 新增字体后我记得好像是要加载一下的,有操作吗? 文件提供一下?我本地试试看看

HI406 commented 4 months ago

没有操作,是在运行demo时import就报错了,不过我大概懂是什么原因了。 我上面的报错是在python 3.9.19下出现的,换成python 2.7.16就正常运行了,easyofd是不支持python3吗?

renoyuan commented 4 months ago

emmm, easyofd 目前开发环境是支持到3.11.5 的。python2 没试过应该是不支持的把。

HI406 commented 4 months ago

谢谢,更新python版本到3.11.5就可以运行了