[Image-SIG] sane.py return incorrect value for options with same name as scanDev attribute

Anders Blomdell anders.blomdell at control.lth.se
Thu Sep 13 13:19:09 CEST 2012


On 2012-09-12 19:06, Anders Blomdell wrote:
> sane.py return incorrect value for options with same name as scanDev
> attribute (found while trying to get the value for the 'scan' button on
> a Canon Lide 110 scanner).
>
> A simple patch is provided, but IMHO the sane.py module could do with
> some cleaning up (how about making it more object oriented...)?
>
>
> --- sane.py 2012-09-12 18:44:41.279360763 +0200
> +++ Imaging-1.1.7/Sane/sane.py 2009-11-01 01:44:12.000000000 +0100
> @@ -70,7 +70,7 @@
> settable = 'no'
> if self.is_active():
> active = 'yes'
> - curValue = repr(self.scanDev.__getattr__(self.py_name))
> + curValue = repr(getattr(self.scanDev, self.py_name))
> else:
> active = 'no'
> curValue = '<not available, inactive option>'

Attached is a non-reversed diff, fixing some more calls, and making 
'open' and 'get_devices' automatically calling '_sane.init'.




-- 
Anders Blomdell                  Email: anders.blomdell at control.lth.se
Department of Automatic Control
Lund University                  Phone:    +46 46 222 4625
P.O. Box 118                     Fax:      +46 46 138118
SE-221 00 Lund, Sweden

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sane.diff
Type: text/x-patch
Size: 2278 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20120913/322618c9/attachment.bin>


More information about the Image-SIG mailing list