Cuneiform fails when invoked from a script
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cuneiform for Linux |
New
|
Undecided
|
Unassigned |
Bug Description
I'm trying to build one-touch scanning using scanbuttond + cuneiform + hocr2pdf. This works when invoked manually, however not when invoked by scanbuttond.
Here's the script I'm using:
#!/bin/bash -x
TMPDIR=/tmp/scan/
SCANDIR=
DEVICE=$1
# -----------------
COUNTER="`cat $SCANDIR/.counter`"
[ -z $COUNTER ] && COUNTER=1
[ ! -e $TMPDIR ] && mkdir -p $TMPDIR
/usr/bin/scanimage -d $DEVICE \
--resolution 300 \
--mode Color \
--source ADF \
--format tiff \
--
sleep 5
for page in $TMPDIR/out*.tiff; do
/opt/cuneiform
/usr/bin/hocr2pdf -i $page -o $SCANDIR/`date +%Y%m%d-
COUNTER=$[ $COUNTER + 1 ];
done
# cleanup
#rm -r $TMPDIR/*
echo $COUNTER > $SCANDIR/.counter
When I invoke the script manually from the command line, everything works fine. However when scanbuttond invokes it after pressing a button on the scanner, cuneiform produces the following error:
PUMA_Init failed.
Cuneiform for Linux 0.6.0
I'm out of ideas on this one, I can even start the script with env -, so it's not some environment-related thing.
"PUMA_Init failed" means that Cuneiform console client failed to initialize the recognition engine. This can happen in various circumstances, notably because:
1) It can't initialise the libraries (use LD_LIBRARY_PATH)
2) It can't read the *.dat files, containing the language support etc.
Sounds like a permission problem to me if it works when you run it manually.