当前位置:网站首页>‘PdfFileWriter‘ object has no attribute ‘stream‘
‘PdfFileWriter‘ object has no attribute ‘stream‘
2022-04-22 05:47:00 【xkxsxkx】
First borrow github The answer on link
% python3 -m venv venv
% source ./venv/bin/activate
[venv] % pip install pypdf2==1.26.0
[venv] % python test.py
1.26.0
[venv] % pip install pypdf2==1.27.3
[venv] % python test.py
1.27.3
Traceback (most recent call last):
File "test.py", line 39, in
main()
File "test.py", line 35, in main
split(pdf_data, split_info)
File "test.py", line 22, in split
pdf_writer.write(tmp_io)
File "/home/dst/Desktop/pypdf2/venv/lib/python3.8/site-packages/PyPDF2/pdf.py", line 480, in write
self._sweepIndirectReferences(externalReferenceMap, self._root)
File "/home/dst/Desktop/pypdf2/venv/lib/python3.8/site-packages/PyPDF2/pdf.py", line 572, in _sweepIndirectReferences
self._sweepIndirectReferences(externMap, realdata)
File "/home/dst/Desktop/pypdf2/venv/lib/python3.8/site-packages/PyPDF2/pdf.py", line 548, in _sweepIndirectReferences
value = self._sweepIndirectReferences(externMap, value)
File "/home/dst/Desktop/pypdf2/venv/lib/python3.8/site-packages/PyPDF2/pdf.py", line 572, in _sweepIndirectReferences
self._sweepIndirectReferences(externMap, realdata)
File "/home/dst/Desktop/pypdf2/venv/lib/python3.8/site-packages/PyPDF2/pdf.py", line 548, in _sweepIndirectReferences
value = self._sweepIndirectReferences(externMap, value)
File "/home/dst/Desktop/pypdf2/venv/lib/python3.8/site-packages/PyPDF2/pdf.py", line 557, in _sweepIndirectReferences
value = self._sweepIndirectReferences(externMap, data[i])
File "/home/dst/Desktop/pypdf2/venv/lib/python3.8/site-packages/PyPDF2/pdf.py", line 572, in _sweepIndirectReferences
self._sweepIndirectReferences(externMap, realdata)
File "/home/dst/Desktop/pypdf2/venv/lib/python3.8/site-packages/PyPDF2/pdf.py", line 548, in _sweepIndirectReferences
value = self._sweepIndirectReferences(externMap, value)
File "/home/dst/Desktop/pypdf2/venv/lib/python3.8/site-packages/PyPDF2/pdf.py", line 589, in _sweepIndirectReferences
newobj = self._sweepIndirectReferences(externMap, newobj)
File "/home/dst/Desktop/pypdf2/venv/lib/python3.8/site-packages/PyPDF2/pdf.py", line 548, in _sweepIndirectReferences
value = self._sweepIndirectReferences(externMap, value)
File "/home/dst/Desktop/pypdf2/venv/lib/python3.8/site-packages/PyPDF2/pdf.py", line 575, in _sweepIndirectReferences
if data.pdf.stream.closed:
AttributeError: 'PdfFileWriter' object has no attribute 'stream'
You can see that the version is 1.26.0 when , It works , The default installed version may be 1.27 above , You're going to report a mistake
So to solve this problem, only
pip install pypdf2==1.26.0
Then it can run normally
版权声明
本文为[xkxsxkx]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220535349144.html
边栏推荐
猜你喜欢
随机推荐
供应链服务术语
寻找矩阵中“块“的个数(BFS)
LeetCode 2055. 蜡烛之间的盘子--前缀和+区间标记
全排列(回溯法)模板
MySQL Basics
数字三角形(动态规划dp)
常见的状态码
TCGA数据库ensembl id 转为 gene Symbol,提取出需要的RNA种类表达谱列表信息
Data mining -- association rule mining
事件监听器
MySQL functions and exercises (II)
D. 388535
Data mining -- data preprocessing
Sum of numerators thinking
通过设置关联菜单建立excel记账本
什么是JSON?初识JSON
机器学习——用鸢尾花数据集画P-R曲线和ROC曲线
LeetCode 486. 预测赢家--动态规划+博弈论
Data mining clustering
JVM exploration









