Red Hat Bugzilla – Bug 860406
python-imaging-sane fails to print some option values for a Canon LiDE 110 scanner
Last modified: 2013-07-24 13:50:40 EDT
Created attachment 617192 [details]
Small program demonstrating problem (on LiDE 110 scanner)
Description of problem:
With a Canon LiDE 110 scanner, python-imaging-sane prints incorrect value for one option ('scan') and get an AttributeError for another ('clear-calibration')
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Run the attached test program
Wrong value 'scan' (Cur value: <bound method SaneDev.scan of <sane.SaneDev instance at 0x8ab110c>>)
AttributeError 'clear-calibration' (Buttons don't have values: clear_calibration)
Created attachment 617194 [details]
First shot at fixing bug
The fix does two things in the __repr__ method:
1. It catches AttributeError's and returns the error-message as current value.
2. It directly calls self.scanDev.__getattr__ to avoid picking up methods that has the same name as any method of SaneDev
Created attachment 617220 [details]
Add a get_value method to the Option class
Add a get_value method to the Option class, then we can use the SaneDev.opt dictionary to get values for options that have the same name as a SaneDev method.
To get the 'scan' button on the LiDE 11o, we can use
devices = sane.get_devices()
for d in devices:
dev = sane.open(d)
print "scan button is", dev.opt['scan'].get_value()
Created attachment 617223 [details]
Make sane.get_devices() return a class with sensible fields insted of tuple
And by inheriting from tuple, we keep backward compatibility.
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora
'version' of '17'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version prior to Fedora 17's end of life.
Bug Reporter: Thank you for reporting this issue and we are sorry that
we may not be able to fix it before Fedora 17 is end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora, you are encouraged change the
'version' to a later Fedora version prior to Fedora 17's end of life.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
I suggest that if not yet done to submit this patch to pillow python-imaging successor:
I am sorry for not having replied before.
I will close this bug as wontfix as pillow is the right place to submit this and other patches for PIL (python-imaging).