I m looking for help about python-sane, The follow sample code try to
grab the image from the webcam through a /dev/video0 on linux, it works
fine for the first 185 times, but it freeze the computer when i ~ 185,
I dont know why?
The computer become very busy when i > 160, very strange?
I m using Ubuntu 5.10 Linux
Thanks
-----------------------code start------------------
#! /usr/bin/python
import sane, time, Image
def grabImage(_webc am):
_webcam.mode='c olor'
_webcam.start()
img=_webcam.sna p()
return img
for i in range(200):
print 'i=', i
sane.init()
webcam = sane.open('v4l:/dev/video0')
grabImage(webca m)
webcam.close()
sane.exit()
time.sleep(1)
----------------------code end-------------------
---------------------output--------------------
i=0
i=1
i=2
.....
i= 182
i= 183
i= 184
i= 185
Traceback (most recent call last):
File "testSane.p y", line 17, in ?
grabImage(webca m)
File "testSane.p y", line 7, in grabImage
_webcam.start()
File "/usr/lib/python2.4/site-packages/sane.py", line 201, in start
return self.dev.start( )
_sane.error: Error during device I/O