Web · Wiki · Activities · Blog · Lists · Chat · Meeting · Bugs · Git · Translate · Archive · People · Donate

Commit d7b1e9ef47a0ea4ffa9e36005e3169fccc37eb21

Work around multi-page scan bug in python-sane 2.6.1

python-sane 2.6.1 doesn't correctly recognise the end of a multi-page
scane in sane._SaneIterator and raises an exception instead of
stopping the iteration. Detect end of scan (signalled by libsane via
the 'error' message "Document feeder out of documents") ourselves and
handle it properly.
scan.py
(10 / 5)
  
515515 images = []
516516 try:
517517 self._dpi = self._device.resolution
518 for image in scan_iter:
519 images.append(self._process_image(image))
520 if self._check_action(['stop', 'quit']):
521 break
518 try:
519 for image in scan_iter:
520 images.append(self._process_image(image))
521 if self._check_action(['stop', 'quit']):
522 break
522523
523 self._dpi = self._device.resolution
524 self._dpi = self._device.resolution
525 except sane.error, exc:
526 # Work around python-sane bug.
527 if str(exc) != 'Document feeder out of documents':
528 raise
524529
525530 self._images = images
526531