Bug 860406 - python-imaging-sane fails to print some option values for a Canon LiDE 110 scanner
python-imaging-sane fails to print some option values for a Canon LiDE 110 sc...
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: python-imaging (Show other bugs)
17
i686 Linux
unspecified Severity medium
: ---
: ---
Assigned To: José Matos
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-25 14:33 EDT by Anders Blomdell
Modified: 2013-07-24 13:50 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-07-24 13:50:40 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Small program demonstrating problem (on LiDE 110 scanner) (689 bytes, text/x-python)
2012-09-25 14:33 EDT, Anders Blomdell
no flags Details
First shot at fixing bug (551 bytes, patch)
2012-09-25 14:40 EDT, Anders Blomdell
no flags Details | Diff
Add a get_value method to the Option class (522 bytes, patch)
2012-09-25 15:04 EDT, Anders Blomdell
no flags Details | Diff
Make sane.get_devices() return a class with sensible fields insted of tuple (630 bytes, patch)
2012-09-25 15:16 EDT, Anders Blomdell
no flags Details | Diff

  None (edit)
Description Anders Blomdell 2012-09-25 14:33:07 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):

python-imaging-sane-1.1.7-4.fc16.i686


How reproducible:

Always

Steps to Reproduce:
1. Run the attached test program
2.
3.
  
Actual results:

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)
Failures: 2

Expected results:

Failures: 0


Additional info:
Comment 1 Anders Blomdell 2012-09-25 14:40:47 EDT
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
Comment 2 Anders Blomdell 2012-09-25 15:04:50 EDT
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

#!/usr/bin/python

import sane 

sane.init()
devices = sane.get_devices()
for d in devices:
    dev = sane.open(d[0])
    print "scan button is", dev.opt['scan'].get_value()
    pass
Comment 3 Anders Blomdell 2012-09-25 15:16:49 EDT
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.
Comment 4 Fedora End Of Life 2013-07-03 18:50:48 EDT
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.
Comment 5 José Matos 2013-07-24 13:50:40 EDT
I suggest that if not yet done to submit this patch to pillow python-imaging successor:

https://github.com/python-imaging/Pillow

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).

Note You need to log in before you can comment on or make changes to this bug.