In camelot python its accept only the current directory , if add the file temporary its not accepted please give me any solution
我遇到错误:
File "/home/arun/.local/lib/python3.5/site-packages/PyPDF2/pdf.py", line 1689, in read
stream.seek(-1, 2)
OSError:[Errno 22]无效的参数
如何添加正确的路径,请通过示例进行解释,这将对我有帮助
def generate_pdf_csv(self):
file_name = self.pdf_name
attachment_dict = {
'name': file_name,
'datas': self.file_upload_pdf,
'datas_fname': file_name,
'res_model': self._name,
'res_id': self.id,
'type': 'binary',
}
attachment_id =
self.env['ir.attachment'].sudo().create(attachment_dict)
temp_dir = tempfile.gettempdir()
temp_path = os.path.join(temp_dir, file_name)
pdf_file = temp_path
tables = camelot.read_pdf(pdf_file, pages='all')
csv_file = 'FOLLL123.csv'
tables.export(csv_file, f='csv', compress=True)
tables[0].to_csv(csv_file)