looking for help about python-sane

derek derek at hotmail.com
Tue Feb 28 10:23:38 EST 2006


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(_webcam):
         _webcam.mode='color'
         _webcam.start()
         img=_webcam.snap()
         return img



for i in range(200):
         print 'i=', i
         sane.init()
         webcam = sane.open('v4l:/dev/video0')
         grabImage(webcam)
         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.py", line 17, in ?
     grabImage(webcam)
   File "testSane.py", 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



More information about the Python-list mailing list