networked scanners not working with python2.4 sane

Bug #88059 reported by jamest
8
Affects Status Importance Assigned to Milestone
python-imaging (Ubuntu)
Fix Released
Undecided
Matthias Klose

Bug Description

Binary package hint: python-imaging-sane

The python2.4 sane module doesn't appear to work with networked scanners under edgy.
Python2.5 appears to be fine.

An attempt from 2.4 to access a scanner.

jamest@floyd:~$ python
Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
[GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sane
>>> print 'SANE version:', sane.init()
SANE version: (16777234, 1, 0, 18)
>>> scanner=sane.open('net:scanner.ajrs.com:avision:libusb:001:002')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/sane.py", line 260, in open
    new=SaneDev(devname)
  File "/usr/lib/python2.4/site-packages/sane.py", line 118, in __init__
    d['sane_signature'] = self._getSaneSignature(devname)
  File "/usr/lib/python2.4/site-packages/sane.py", line 126, in _getSaneSignature
    raise RuntimeError('no scanner available')
RuntimeError: no scanner available
>>>

Now the same attempt from python2.5

jamest@floyd:~$ python2.5
Python 2.5 (r25:51908, Oct 6 2006, 15:22:41)
[GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sane
>>> print 'SANE version:', sane.init()
SANE version: (16777234, 1, 0, 18)
>>> scanner=sane.open('net:scanner.ajrs.com:avision:libusb:001:002')
>>> print 'SaneDev object=', scanner
SaneDev object= <sane.SaneDev instance at 0xb7d1356c>
>>>

Revision history for this message
Jason Parekh (jasonparekh) wrote :

Seems to reappear in Feisty (never tested the problem under Edgy myself).

Attached is a fix. The problem is there isn't an initial value for the optional variable local_only in PySane_get_devices(). So, when sane.get_devices() is called without an argument (like it is through sane.open()), the value of local_only will be arbitrary leading to local only operation with high probability.

Jason Parekh

Revision history for this message
Matthias Klose (doko) wrote :

fixed in python-imaging_1.1.6-0ubuntu3

Changed in python-imaging:
assignee: nobody → doko
status: Unconfirmed → Fix Released
Revision history for this message
Ulf Renman (ulf-renman) wrote :

Has this been broken again? I have a similar problem but my scanner is not networked, but local. Im on Ubuntu Intrepid Ibex.

Some output from my system:
ulf@hovermo:~(0)$ groups
ulf adm lp dialout cdrom plugdev scanner lpadmin admin sambashare
ulf@hovermo:~(0)$ cat /proc/version
Linux version 2.6.27-11-generic (buildd@rothera) (gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu11) ) #1 SMP Thu Jan 29 19:24:39 UTC 2009
ulf@hovermo:~(0)$ scanimage -L
device `epkowa:libusb:001:012' is a Epson Perfection V10/V100 flatbed scanner
ulf@hovermo:~(0)$ python
Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sane
>>> sane.get_devices()
[]
>>> sane.open('epkowa:libusb:001:012')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/sane.py", line 288, in open
    new=SaneDev(devname)
  File "/usr/lib/python2.5/site-packages/sane.py", line 143, in __init__
    d['sane_signature'] = self._getSaneSignature(devname)
  File "/usr/lib/python2.5/site-packages/sane.py", line 151, in _getSaneSignature
    raise RuntimeError('no scanner available')
RuntimeError: no scanner available
>>>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.