-
Notifications
You must be signed in to change notification settings - Fork 359
can't get read_pdf to work on Windows #140
Comments
Thanks for the report @topper-123! Did you install Camelot using pip or conda? Did you install the dependencies before that? (specifically ghostscript, which is used to convert a PDF into an image) If yes, what is the name of your ghostscript executable and is it in the Windows PATH variable? You can do this check to see if ghostscript was installed correctly. I suspect that the subprocess call to ghostscript is failing silently. |
I've got ghostscript installed, but Maybe Camelot should on the first call to ghostscript do a existence check for ghostscript (a la |
Do you have 32-bit Windows? Otherwise, you should look for gswin64c.exe. |
I'm facing the same issue. My gWin64c.exe seems to be working, although when I try opening it through cmdPromt I get "App can't run on your PC" Dialogue and "access denied" in cmd-line which is strange considering the .exe file works fine if accessed on its own. |
I had the same issue. I eventually got it working by adding "C:\Program Files\gs\gs9.25\bin" to my Path |
@aakashdusane @mattmurray Did you check out this part of the install documentation? https://camelot-py.readthedocs.io/en/master/user/install.html#for-windows It says that ghostscript needs to be on the PATH. I guess I should fix and merge #133 soon, which changes the ghostscript subprocess call to an API call. |
It's is on my file path, that's why I'm perplexed. I haven't tried Matt's
solution yet, will update once I do.
UPDATE: Doesn't seem to work for me. trying to execute gswin64c.exe (even after adding to path) on command line still gives the same error. However, cd to "C:\Program Files\gs\gs9.25\bin" and then execute works.
|
Alright, I've figured out what it was. It was/is two issues: 1: 2: if info['system'] == 'windows':
bit = info['machine'][-2:] # '64' on my machine
gs_call.insert(0, 'gswin{}c.exe'.format(bit)) This means Camelot doesn't pick up on my ghostScript, because the file is gwsin32c.exe, not gswin64c.exe.. You support python2.7, but FYI, python3 shutil module has a which command to make existence checks easy on windows, so so the above could be replaced with: if info['system'] == 'windows':
gswin64, gswin32 = 'gswin64c.exe', 'gswin32c.exe'
if shutil.which(gswin64):
gs_call.insert(0, gswin64)
elif shutil.which(gswin32):
gs_call.insert(0, gswin32)
else:
raise OSError("GhostScript not found. Check that it is installed and the path is set correctly") I don't know how to do that in Python2.7, but presumably there is a way. |
Thanks for the suggestion @topper-123, I've created a PR! |
Hey, I ran into the same issue. I'm not very familiar with OS related aspects. However, I understood that Python is on path1, say whereas the gswin64 is in path2. How do I make Python see that different folder in C drive? I tried sys.path.append("C:\Program Files\gs") but to no avail. Thanks in anticipation. |
Assumedly others can get read_pdf to work, so this is just an error report to fix some bug instance.
Anyway, when I - after downloading
foo.pdf
into the working directory - docamelot.read_pdf('foo.pdf')
, I getDigging into the debugger, I see that in the Lattice object, the temp image file does not exist. So when at one point
camelot.parsers.lattice.Lattice._generate_image
is called, the error occurs, because the file in image_file doesn't exist:So apparantly the file in question hasn't been created.
I could diagnsose the issue some more, if I could get some guidance...
The text was updated successfully, but these errors were encountered: