我阅读了问题并使用了以下代码:
从pdfminer.pdfparser导入PDFParser从pdfminer.pdfdocument导入PDFDocument
import magic
from pyPdf import PdfFileWriter, PdfFileReader
import tabula
import numpy as np
filename = '/home/parser/test.pdf'
magic.from_file(filename,mime=True)
ifpdf = PdfFileReader(file(filename, "rb"))
pdf_info = ifpdf.getDocumentInfo()
nm = [ 'Info_1', 'Info_2','Info_3','Info_4']
df = tabula.read_pdf(filename,pages="all",lattice="all",pandas_options={'header': None,'names':nm,'encoding':'utf-8'})
df.refenseigne.replace(to_replace=r"(M|C)\r",value="",regex=True,inplace=True)
df.to_csv("test.csv",encoding="utf-8")当我执行我的代码时,我会得到这个错误。
Traceback (most recent call last):
File "parse_pdf.py", line 16, in <module>
df = tabula.read_pdf(filename,pages="all",lattice="all",pandas_options={'header': None,'names':nm,'encoding':'utf-8'})
File "/usr/local/lib/python2.7/dist-packages/tabula/wrapper.py", line 87, in read_pdf
output = subprocess.check_output(args)
File "/usr/lib/python2.7/subprocess.py", line 567, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory奇怪的是,在第9行和第11行,我可以找到文件,但是在第16行,我有这个错误。
我是错了还是小菜问题?
发布于 2019-05-10 07:11:47
我在Ubuntu也面临着同样的问题。
首先,通过运行java -版本和javac -版本,检查安装在计算机上的JDK和JRE的版本。每个版本都应该大于7。
然后使用pip3安装tabula。
它开始读取,但显示了以下错误
WARNING: Using fallback font 'LiberationSerif' for 'TimesNewRomanPSMT'
May 10, 2019 12:36:29 PM org.apache.pdfbox.pdmodel.font.PDTrueTypeFont https://stackoverflow.com/questions/51652269
复制相似问题