且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Python将PDF转换为图像

更新时间:2023-02-12 20:47:42

我也在python2中失败,但在python3中成功.

I failed in python2 too, but succeeded in python3.

另一个库也发生了相同的问题: TypeError:"threadsafe_iter"对象不是迭代器

There's a same issue happened on an other library: TypeError: 'threadsafe_iter' object is not an iterator

正如他们所说,这是python 2 vs 3的问题,由next()函数引起.
如果修改文件/home/***/.local/lib/python2.7/site-packages/pdf2image/generators.py中的__next__()-> next(),它将在py2中成功运行.

As they said, it's a python 2 vs 3 issue, caused by next() function.
If modify __next__() -> next() in file/home/***/.local/lib/python2.7/site-packages/pdf2image/generators.py , it will run successful in py2.

顺便说一句,我已经为pdf2image团队创建了一个新期刊.
TypeError:ThreadSafeGenerator对象不是迭代器#133

BTW, i have create a new issue to pdf2image team.
TypeError: ThreadSafeGenerator object is not an iterator #133

其他
pdf2image自述文件表示这是python(3.5+)模块.
pdf2image v1.7.1适用于py27.尝试通过pip install pdf2image==1.7.1

Additional
pdf2image readme said it's a python (3.5+) module.
pdf2image v1.7.1 work on py27. try it by pip install pdf2image==1.7.1