pdf-to-excel
pdf-to-excel copied to clipboard
JAVA HOME not set?
from bash terminal:
root@codespaces-50baea:/workspaces/pdf-to-excel# python pdf_to_excel.py
Failed to import jpype dependencies. Fallback to subprocess.
No module named 'jpype'
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/tabula/backend.py", line 122, in call_tabula_java
result = subprocess.run(
File "/usr/local/lib/python3.8/subprocess.py", line 493, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/lib/python3.8/subprocess.py", line 1720, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'java'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "pdf_to_excel.py", line 15, in <module>
pdf_to_excel('Camden HR Survey 1995-1996_EXTRACTION.pdf', 'camden.xlsx')
File "pdf_to_excel.py", line 7, in pdf_to_excel
tables = tabula.read_pdf(pdf_file_path, pages='all')
File "/usr/local/lib/python3.8/site-packages/tabula/io.py", line 400, in read_pdf
output = _run(
File "/usr/local/lib/python3.8/site-packages/tabula/io.py", line 86, in _run
return _tabula_vm.call_tabula_java(options, path)
File "/usr/local/lib/python3.8/site-packages/tabula/backend.py", line 133, in call_tabula_java
raise JavaNotFoundError(JAVA_NOT_FOUND_ERROR)
tabula.errors.JavaNotFoundError: `java` command is not found from this Python process.Please ensure Java is installed and PATH is set for `java`
seemed to be missing jpype, so pip installed jpype1 and ran again:
root@codespaces-50baea:/workspaces/pdf-to-excel# python pdf_to_excel.py
Traceback (most recent call last):
File "pdf_to_excel.py", line 15, in <module>
pdf_to_excel('Cfoobar.pdf', 'cfoobar.xlsx')
File "pdf_to_excel.py", line 7, in pdf_to_excel
tables = tabula.read_pdf(pdf_file_path, pages='all')
File "/usr/local/lib/python3.8/site-packages/tabula/io.py", line 400, in read_pdf
output = _run(
File "/usr/local/lib/python3.8/site-packages/tabula/io.py", line 74, in _run
_tabula_vm = TabulaVm(java_options=java_options, silent=options.silent)
File "/usr/local/lib/python3.8/site-packages/tabula/backend.py", line 45, in __init__
jpype.startJVM(*java_options, convertStrings=False)
File "/usr/local/lib/python3.8/site-packages/jpype/_core.py", line 238, in startJVM
jvmpath = getDefaultJVMPath()
File "/usr/local/lib/python3.8/site-packages/jpype/_jvmfinder.py", line 70, in getDefaultJVMPath
return finder.get_jvm_path()
File "/usr/local/lib/python3.8/site-packages/jpype/_jvmfinder.py", line 204, in get_jvm_path
raise JVMNotFoundException("No JVM shared library file ({0}) "
jpype._jvmfinder.JVMNotFoundException: No JVM shared library file (libjvm.so) found. Try setting up the JAVA_HOME environment variable properly.
I guess it didn't set up all the way? I gave it a lot of time. I also tried a different terminal jic javascript debug terminal:
root@codespaces-50baea:/workspaces/pdf-to-excel# python pdf_to_excel.py
Failed to import jpype dependencies. Fallback to subprocess.
No module named 'jpype'
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/tabula/backend.py", line 122, in call_tabula_java
result = subprocess.run(
File "/usr/local/lib/python3.8/subprocess.py", line 493, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/lib/python3.8/subprocess.py", line 1720, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'java'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "pdf_to_excel.py", line 15, in <module>
pdf_to_excel('Cfoobar.pdf', 'cfoobar.xlsx')
File "pdf_to_excel.py", line 7, in pdf_to_excel
tables = tabula.read_pdf(pdf_file_path, pages='all')
File "/usr/local/lib/python3.8/site-packages/tabula/io.py", line 400, in read_pdf
output = _run(
File "/usr/local/lib/python3.8/site-packages/tabula/io.py", line 86, in _run
return _tabula_vm.call_tabula_java(options, path)
File "/usr/local/lib/python3.8/site-packages/tabula/backend.py", line 133, in call_tabula_java
raise JavaNotFoundError(JAVA_NOT_FOUND_ERROR)
tabula.errors.JavaNotFoundError: `java` command is not found from this Python process.Please ensure Java is installed and PATH is set for `java`