Program crashes when I select a file with Enter
btbytes opened this issue · 11 comments
Program crashes when I select a file with Enter
$ pboy
pboy: fd:50: hGetContents: invalid argument (invalid byte sequence)
Thanks for raising this! Do you select the file from your inbox folder? Could you maybe attach the pdf in question? Or does it happen for all the files?
Happens with all the PDFs I've tried so far. They are different kinds of PDFs - presentations, scanned docs, LaTeX'd docs etc.,
I assume you're using mac? Could you tell me
- the pdftotext version:
pdftotext -v
and same thing for pdfinfo:pdfinfo -v
. - the output when you run
locale
on the terminal.
By the way, I suggest installing the pdf utilities with the poppler
package.
It would be great if you could also run these two programs on some of the pdfs directly i.e pdftotext file.pdf
and let me know if that works fine.
- pdftotext:
pdftotext -v
pdftotext version 3.03
Copyright 1996-2011 Glyph & Cog, LLC
- pdfinfo:
pdfinfo -v
pdfinfo version 4.00
Copyright 1996-2017 Glyph & Cog, LLC
NOTE: To install both above brew install xpdf
.
- locale:
locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
pdfinfo Downloads/nim-basics.pdf
Title: Nim basics
Creator: Asciidoctor PDF 1.5.0.alpha.16, based on Prawn 2.2.2
Producer: Asciidoctor PDF 1.5.0.alpha.16, based on Prawn 2.2.2
CreationDate: Wed Jun 13 16:47:13 2018
ModDate: Wed Jun 13 16:47:13 2018
Tagged: no
Form: none
Pages: 74
Encrypted: no
Page size: 595.28 x 841.89 pts (A4) (rotated 0 degrees)
File size: 665897 bytes
Optimized: no
PDF version: 1.3
pdftotext Downloads/nim-basics.pdf
(generates nim-basics.txt)
Even after installing and verifying the softwares work, pboy
still crashes.
Thank you very much for checking!
Very strange. I will try to reproduce this with the versions from xpdf, in the meantime I suggest you try installing poppler instead of xpdf. It's a fork of the latter and should work overall better.
Otherwise I'll leave the issue open until I implement some better error handling.
I am see this too on Ubuntu 18.04. I get the following error:
pboy: readCreateProcess: open "/home/mac/pboy/EY_Contracts_optimisation.pdf" (exit 1): failed
➜ pboy git:(master) pdftotext -v
pdftotext version 0.62.0
Copyright 2005-2017 The Poppler Developers - http://poppler.freedesktop.org
Copyright 1996-2011 Glyph & Cog, LLC
➜ pboy git:(master) pdfinfo -v
pdfinfo version 0.62.0
Copyright 2005-2017 The Poppler Developers - http://poppler.freedesktop.org
Copyright 1996-2011 Glyph & Cog, LLC
Thank you for the details @maacl.
I think I will build in a catch for these exceptions.
This will result in fewer suggestions, but at least it will make pboy usable for you and @btbytes and give me time to reproduce this with various combinations of pdftotext/pdfinfo versions, or maybe on my Linux machine.
The Linux issue is a different problem due to open
being a mac utility afaik.
True, I keep forgetting that open
is the other dependency, in addition the the poppler stuff. I was under the impression that a lot of distros provide open
, but I will check and catch that as well.
In fact, could you check if you have xdg-open
?
I was going to implement that but the nix issue prevents me from doing that...
This is how I wanted to implement that:
openFunction :: IO FilePath
openFunction = do
exec <- listToMaybe . catMaybes <$> traverse findExecutable executables
maybe (error $ "None of the open commands (" ++ intersperse ',' executables ++ ") are available.") pure exec
where
executables = ["open", "xdg-open"]