1

I am trying to extract table from a pdf using tabula -py in python.But I am getting CalledProcessError

from tabula import read_pdf
df=read_pdf("table.pdf",pages="all")

Error:
CalledProcessError: Command '['java', '-jar', 
'C:\\ProgramData\\Anaconda2\\lib\\site-packages\\tabula\\tabula-1.0.1-jar- 
with-dependencies.jar', '--pages', 'all', '--guess', 'table.pdf']' returned 
non-zero exit status 2

Java Version : 1.8.0_131

OS - windows 7

This question (tabula-py CalledProcessError: Command '['java', '-jar') suggests upgrading to java 1.8.However, I already have java 1.8, but still getting the error.

Any help on this will be really appreciated. Thanks !

Manish Pathak
  • 55
  • 1
  • 7
  • It might be JAVA PATH problem. Could you upgrade tabula-py and run `import tabula; tabula.environment_info()` ? – chezou May 13 '18 at 01:05

3 Answers3

0

This command may create some files in current directory which may not reply in editer. So I placed the pdf file in the same location where the script was saved and it work for me

Pp jym
  • 1
0

Thanks @Pp jym & @chezou for response !

However,the problem happened because java was trying to run a java 7 VM where it found a JRE 8.Steps suggested in the question Registry key Error: Java version has value '1.8', but '1.7' is required helped to fix the error.

Manish Pathak
  • 55
  • 1
  • 7
0

This worked for me:

  1. Open Run, type 'regedit'
  2. go to: HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
  3. Change the JavaHome and RuntimeLib locations to where your jre is installed. (mine was C:\Program Files\Java\jre and C:\Program Files\Java\jre\bin\server\jvm.dll respectively)
Idris
  • 29
  • 1
  • 6