Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

使用demo中的案例,出现No module named 'easyofd.ofd' #19

Open
Intvarinit opened this issue Jul 16, 2024 · 3 comments
Open

使用demo中的案例,出现No module named 'easyofd.ofd' #19

Intvarinit opened this issue Jul 16, 2024 · 3 comments

Comments

@Intvarinit
Copy link

import base64
from easyofd.ofd import OFD # 安装包

出现No module named 'easyofd.ofd',pip list结果:
easyofd 0.0.8

@renoyuan
Copy link
Owner

是否可以尝试更新一下版本目前版本是 0.3.1

@Intvarinit
Copy link
Author

更新之后,在python3.9环境下出现错误

import base64
from easyofd.ofd import OFD

def pdf2ofd(pdf_pth,out_pth):
    with open(pdf_pth,"rb") as f:
       pdfb64 = f.read()
    ofd = OFD()
    ofd_bytes = ofd.pdf2ofd(pdfb64,optional_text=False)
    ofd.del_data()
    with open(out_pth,"wb") as f:
       f.write(ofd_bytes)
    
def ofd2pdf(ofd_pth,out_pth):
    with open(ofd_pth,"rb") as f:
       ofdb64 = str(base64.b64encode(f.read()),"utf-8")
    ofd = OFD()
    ofd.read(ofdb64)
    pdf_bytes = ofd.to_pdf()
    with open(out_pth,"wb") as f:
       f.write(pdf_bytes)

out_file = "test.ofd"
pdf_file = "test.pdf"
pdf2ofd(pdf_pth=pdf_file,out_pth=out_file)

`

TypeError Traceback (most recent call last)
Cell In[1], line 2
1 import base64
----> 2 from easyofd.ofd import OFD
4 def pdf2ofd(pdf_pth,out_pth):
5 with open(pdf_pth,"rb") as f:
......
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
`

@renoyuan
Copy link
Owner

更新下python 版本?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants