Hi All,
I am trying to use the Camelot package inside the python tool in Alteryx. I have the required dependencies - Ghostscript and Tkinter.
I am getting the following error when using this package:
OSError Traceback (most recent call last) <ipython-input-5-f57fc83b89cc> in <module> ----> 1 tables = camelot.read_pdf(r"C:\Users\user\Downloads\Equipment_List.pdf", pages='2') 2 3 #Get the dataframe from the PDF table data 4 print(tables) 5 c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\camelot\io.py in read_pdf(filepath, pages, password, flavor, suppress_stdout, layout_kwargs, **kwargs) 111 p = PDFHandler(filepath, pages=pages, password=password) 112 kwargs = remove_extra(kwargs, flavor=flavor) --> 113 tables = p.parse( 114 flavor=flavor, 115 suppress_stdout=suppress_stdout, c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\camelot\handlers.py in parse(self, flavor, suppress_stdout, layout_kwargs, **kwargs) 174 parser = Lattice(**kwargs) if flavor == "lattice" else Stream(**kwargs) 175 for p in pages: --> 176 t = parser.extract_tables( 177 p, suppress_stdout=suppress_stdout, layout_kwargs=layout_kwargs 178 ) c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\camelot\parsers\lattice.py in extract_tables(self, filename, suppress_stdout, layout_kwargs) 419 return [] 420 --> 421 self.backend.convert(self.filename, self.imagename) 422 423 self._generate_table_bbox() c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\camelot\backends\ghostscript_backend.py in convert(self, pdf_path, png_path, resolution) 29 def convert(self, pdf_path, png_path, resolution=300): 30 if not self.installed(): ---> 31 raise OSError( 32 "Ghostscript is not installed. You can install it using the instructions" 33 " here: https://camelot-py.readthedocs.io/en/master/user/install-deps.html" OSError: Ghostscript is not installed. You can install it using the instructions here: https://camelot-py.readthedocs.io/en/master/user/install-deps.html
I tried to use the following 2 methods to see whether GhostScript is installed properly or not.
1.
PS C:\Users\user> gswin32c.exe -version
GPL Ghostscript 9.55.0 (2021-09-27)
Copyright (C) 2021 Artifex Software, Inc. All rights reserved.
2.
import ctypes
from ctypes.util import find_library
find_library("".join(("gsdll", str(ctypes.sizeof(ctypes.c_voidp) * 8), ".dll")))
- This returned nothing
I also have the bin folder location of ghostscript set in the path variable.
What other steps could I take to ensure this starts working?