474,039 Members | 14,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

looking for help about python-sane

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
Feb 28 '06 #1
3 3291
JW
Every time, or just this run?

Mar 1 '06 #2
JW wrote:
Every time, or just this run?

every time
Mar 1 '06 #3
JW
Sorry, I can't help much with the issue. You are getting a low-level
hardware fault, and
not much information is being propagated up throught the system. It's
not a Python problem, but something with SANE, and the Python wrapper
is just propagating the SANE error to you. I have a few suggestions:

- Use a try block, and see if you can recover:

try:
grabImage(webca m)
except _sane.Error, se:
print se
# but continue

See if all you get is errors, or if it's just a once-in-a-while thing.
Maybe you should sleep longer when you get an error, to give the system
a chance to do something else.

- Try to figure out if SANE is printing any logging message. Check the
kernel log (dmesg), the normal system log, read SANE man pages, etc.
- Read the sane-v4l man page. The one I found on the Internet says it
is Alpha software, which means it is highly experimental, but maybe it
has improved.
- Try a similar task using the native sane tools (sane-find-scanner,
scanimage, etc.). This may generate more useful error messages.
- Post a question to the SANE mailing lists:
http://www.sane-project.org/mailing-lists.html

Once you have a happy SANE setup, then it should be trivial modify the
Python code to do the same thing. Hope this is some help,
JW

Mar 2 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2512
by: BlackHawke | last post by:
Hello! My name is Nick Soutter, I am the owner of a small game company in San Diego, CA called Aepox Games (www.aepoxgames.net). Our first product, Andromeda Online (www.andromedaonline.net), goes
9
2222
by: Michael Foord | last post by:
I'm looking to learn C to move some 'speed sensitive' code from C to python. I'm partly doign this as an exercise to learn a static language to help broaden my programming skills - so please don't jump on the bandwagon and tell me I'd be better placed to put my efforts into optimising my python code !! I'd like to use tools like Pyrex and weave with the GCC compiler on windoze. I've got Pyrex working... but weave doesn't seem t...
4
1482
by: Xah Lee | last post by:
while programing in Python, one can lookup syntax or info for keywords or modules within Python. In the command line, type python to get into the python interactive program. then type help() >From there one can type any keyword or module name to find out the
6
2248
by: LenS | last post by:
Hello Was wandering if there is any place where some one could go to get mentoring on python coding. I have started coding in python but I am the only one in the shop using it. So there is no one around to look over my code give suggestions on improvement, in style, logic, easier ways of doing things etc. I am not really looking for hand holding as much mentoring. I have purchased about every python book out and have a list a mile...
17
2014
by: ToddLMorgan | last post by:
I'm just starting out with python, after having a long history with Java. I was wondering if there were any resources or tips from anyone out there in Python-land that can help me make the transition as successfully as possible? Perhaps you've made the transition yourself or just have experience with folks who have made the transition. I'm looking for the common types of mistakes that say a Java/C# or even C++ developer may commonly...
8
2320
by: Eric_Dexter | last post by:
I was looking for a simple way to load a simple python program from another python program. I tried os.system(cabel) The file name is cabel.py a csound instrument editor.. The error I am getting is
12
2444
by: amogan | last post by:
**If interested & qualified, please reply with your resume directly to amogan@google.com** Referrals are always welcome!! Network System Test Engineer - Mountain View This position is available in Mountain View, CA.
5
1106
by: John Antypas | last post by:
Hello all, I'm writing in tool in Python that manipulates various data objects read from various streams. I wanted to give the user a chance to do advanced work that could not easily be done from a GUI. At first, I tried putting in a lightweight scripting language, and then I thought, why not include Python in itself -- it is certainly powerful enough.
2
1124
by: Dudeja, Rajat | last post by:
Hi, I'm new to Python. I only have read "Byte of Python" by Swaroop C H just to be familiar with sytax of python. I've installed Python 2.5 from Active State and using its PythonWin Editor / interpreter. This, unfortunaltely, does not help in debugging. I'm looking for an open source IDE / editor that has source level debugging. Please suggest some tool.
0
885
by: Alexandru Palade | last post by:
As for the open source IDE you can always try Eclipse with PyDev extension. Dudeja, Rajat wrote:
0
10329
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
12124
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11594
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11986
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
11132
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6644
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6815
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5402
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3953
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.