Hi, hm, interesting. My guess would be that you have a simplex document? Probably never tested the script in that case.
Short explanation. SDAPS basically assumes internally that all surveys
are printed and scanned in duplex mode. To handle simplex mode the
"sdaps add" command inserts a special dummy page so that exactly this
failure does not happen.
If you scanned in simplex mode then apply the attached patch. If you
scanned in duplex mode, then just run the second add_image there
unconditionally instead.
Benjamin
On Mi, 2015-09-30 at 20:47 +0000, Terrence Kovacs wrote:
> I have a sdaps tenq survey which I can run:
> [tkovacs@sunspot new]$ sdaps tenq recognize
> ---------------------------------------------------------------------
> ---------
> - SDAPS -- recognize
> ---------------------------------------------------------------------
> ---------
> 6 sheets
> |################################################################|
> 100% 00:00:01
> 0.219686 seconds per sheet
>
> without issue but the custom script throws an error. Am I doing
> something wrong?
>
> [tkovacs@sunspot new]$ ./sdaps-recognize.py tenq tenq_scan.tif
> Traceback (most recent call last):
> File "./sdaps-recognize.py", line 73, in <module>
> survey.questionnaire.recognize.recognize()
> File "/usr/lib64/python2.7/site
> -packages/sdaps/recognize/buddies.py", line 479, in recognize
> res = self.identify(clean=False)
> File "/usr/lib64/python2.7/site
> -packages/sdaps/recognize/buddies.py", line 465, in identify
> self.obj.sheet.recognize.recognize()
> File "/usr/lib64/python2.7/site
> -packages/sdaps/recognize/buddies.py", line 85, in recognize
> self.duplex_copy_image_attr(failed_pages, 'rotated', _("Neither
> %s, %i or %s, %i has a known rotation!"))
> File "/usr/lib64/python2.7/site
> -packages/sdaps/recognize/buddies.py", line 292, in
> duplex_copy_image_attr
> second = self.obj.images[i + 1]
> IndexError: list index out of range
>
> Terrence Kovacs
> Research Systems Engineer
> Physics and Astronomy Department
> Dartmouth College
> Wilder 341, 603-646-9303From d11a9afc5aa964593f4cb86ebfe9a3e6f7e918d1 Mon Sep 17 00:00:00 2001 From: Benjamin Berg <[email protected]> Date: Wed, 30 Sep 2015 23:01:27 +0200 Subject: [PATCH] sdaps-recognize: Handle simplex document in example custom script. Signed-off-by: Benjamin Berg <[email protected]> --- custom-scripts/sdaps-recognize.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/custom-scripts/sdaps-recognize.py b/custom-scripts/sdaps-recognize.py index f1fa649..ac4f26c 100755 --- a/custom-scripts/sdaps-recognize.py +++ b/custom-scripts/sdaps-recognize.py @@ -68,6 +68,8 @@ while images: if survey.defs.duplex: add_image(survey, *images.pop(0)) + else: + add_image(survey, 'DUMMY', -1) # Run the recognition algorithm over the given images survey.questionnaire.recognize.recognize() -- 2.6.0
signature.asc
Description: This is a digitally signed message part
