Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52659 > unrolled thread

Need somebody schmardter than me

Started byGene Heskett <gheskett@wdtv.com>
First post2013-08-18 16:09 -0400
Last post2013-08-18 19:33 -0400
Articles 5 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  Need somebody schmardter than me Gene Heskett <gheskett@wdtv.com> - 2013-08-18 16:09 -0400
    Re: Need somebody schmardter than me Roy Smith <roy@panix.com> - 2013-08-18 16:19 -0400
      Re: Need somebody schmardter than me Gene Heskett <gheskett@wdtv.com> - 2013-08-18 16:48 -0400
      Re: Need somebody schmardter than me Chris Angelico <rosuav@gmail.com> - 2013-08-18 22:20 +0100
    Re: Need somebody schmardter than me Gene Heskett <gheskett@wdtv.com> - 2013-08-18 19:33 -0400

#52659 — Need somebody schmardter than me

FromGene Heskett <gheskett@wdtv.com>
Date2013-08-18 16:09 -0400
SubjectNeed somebody schmardter than me
Message-ID<mailman.2.1376856608.19984.python-list@python.org>
Greetings all;

I am trying to make a machine vision kit of modules work in linuxcnc, which 
uses a lot of python for scripts and gui controls in the user interface.

This is on a Ubu 10.04.4 LTS install, which because linuxcnc is intimately 
married to an RTAI equipt kernel version, has not been updated past 
2.6.32-12x-RTAI.  Those patches are very invasive but a 3.8.something 
version is being worked on as we speak.

But in the meantime, in an effort to debug the failure of the camera 
application to work WITH linuxcnc, I ran the debug level up to maximum to 
see if I might find the first point of failure, and get this on the console 
when linuxcnc is launched from the cli:
================

Xlib.protocol.request.QueryExtension
parse error?
unable to instantiate [/dev/video0]

================

Then it reverts to the normal traceback reporting the same thing but 
quoting the line numbers of the two scripts that led to the failed call.

/dev/video0 exists, is created when the usb cable from the camera is 
plugged in, and the program "cheese" can display this cameras output just 
fine using /dev/video0 as the src device.

When cheese runs this camera, there is a several second delay while cheese 
is apparently talking to it to establish the correct output format before 
cheese starts displaying its output, so I am wondering if an initialization 
time delay might be the fix, but I haven't a clue about how to go about 
that in python despite my copying the list for what, a year or more now?

So, where should I start?

Heck, maybe I might learn a bit of python while running this one down. ;-)

Thanks all.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
My views 
<http://www.armchairpatriot.com/What%20Has%20America%20Become.shtml>
From 0 to "what seems to be the problem officer" in 8.3 seconds.
		-- Ad for the new VW Corrado
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
         law-abiding citizens.

[toc] | [next] | [standalone]


#52660

FromRoy Smith <roy@panix.com>
Date2013-08-18 16:19 -0400
Message-ID<roy-913E78.16195518082013@news.panix.com>
In reply to#52659
In article <mailman.2.1376856608.19984.python-list@python.org>,
 Gene Heskett <gheskett@wdtv.com> wrote:

[much that doesn't appear to have anything to do with Python elided]

> When cheese runs this camera, there is a several second delay while cheese 
> is apparently talking to it to establish the correct output format before 
> cheese starts displaying its output, so I am wondering if an initialization 
> time delay might be the fix,

In general, when you have some sort of synchronization problem, i.e., 
"this piece of code must not start running until that other thing is 
completed", sticking in a time delay is:

1) Almost always the wrong thing to do.

2) Very often the most simple solution.

How it can simultaneously be both of these is left as an exercise for 
the reader :-)

> but I haven't a clue about how to go about that in python

import time
time.sleep(1.5)

will sleep for 1.5 seconds.

[toc] | [prev] | [next] | [standalone]


#52663

FromGene Heskett <gheskett@wdtv.com>
Date2013-08-18 16:48 -0400
Message-ID<mailman.4.1376858901.19984.python-list@python.org>
In reply to#52660
On Sunday 18 August 2013 16:38:52 Roy Smith did opine:

> In article <mailman.2.1376856608.19984.python-list@python.org>,
>  Gene Heskett <gheskett@wdtv.com> wrote:
> 
> [much that doesn't appear to have anything to do with Python elided]
> 
> > When cheese runs this camera, there is a several second delay while
> > cheese is apparently talking to it to establish the correct output
> > format before cheese starts displaying its output, so I am wondering
> > if an initialization time delay might be the fix,
> 
> In general, when you have some sort of synchronization problem, i.e.,
> "this piece of code must not start running until that other thing is
> completed", sticking in a time delay is:
> 
> 1) Almost always the wrong thing to do.
> 
> 2) Very often the most simple solution.
> 
> How it can simultaneously be both of these is left as an exercise for
> the reader :-)
> 
Oh Loverly...

> > but I haven't a clue about how to go about that in python
> 
> import time

That of course goes near the top of the script.

> time.sleep(1.5)

I'll see if I can see a sensible place to add this one.
> will sleep for 1.5 seconds.

Thanks.  Its likely I'll be back because now that I think about it, that 
first line I quoted is quite likely from the function itself, and doesn't 
serve to establish the context of the call, hence the actual arguments to 
it.

Its one of those cases where, if the function were to also echo the 
arguments it was handed, the troubleshooting would be a lot more 
straightforward because you could then see the error causer right up front.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
My views 
<http://www.armchairpatriot.com/What%20Has%20America%20Become.shtml>
Automobile, n.:
	A four-wheeled vehicle that runs up hills and down pedestrians.
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
         law-abiding citizens.

[toc] | [prev] | [next] | [standalone]


#52664

FromChris Angelico <rosuav@gmail.com>
Date2013-08-18 22:20 +0100
Message-ID<mailman.5.1376860817.19984.python-list@python.org>
In reply to#52660
On Sun, Aug 18, 2013 at 9:48 PM, Gene Heskett <gheskett@wdtv.com> wrote:
>> import time
>
> That of course goes near the top of the script.
>
>> time.sleep(1.5)
>
> I'll see if I can see a sensible place to add this one.

The import doesn't have to happen near the top of the script; it's an
executable statement like any other. If you want to keep it near the
time.sleep() call, that'll work fine. It's up to you to decide what
goes where.

ChrisA

[toc] | [prev] | [next] | [standalone]


#52669

FromGene Heskett <gheskett@wdtv.com>
Date2013-08-18 19:33 -0400
Message-ID<mailman.9.1376875484.19984.python-list@python.org>
In reply to#52659
On Sunday 18 August 2013 19:30:43 Chris Angelico did opine:

> On Sun, Aug 18, 2013 at 9:48 PM, Gene Heskett <gheskett@wdtv.com> wrote:
> >> import time
> > 
> > That of course goes near the top of the script.
> > 
> >> time.sleep(1.5)
> > 
> > I'll see if I can see a sensible place to add this one.
> 
> The import doesn't have to happen near the top of the script; it's an
> executable statement like any other. If you want to keep it near the
> time.sleep() call, that'll work fine. It's up to you to decide what
> goes where.
> 
> ChrisA

Actually, I just found the authors names in the manpage.  They wrote this 
thing back in Ubuntu Hardy 8.04 LTS days, so I have posted a note and a 
screen shot pix to them as I am now convinced its a Hardy to Lucid thing.

Thank you for taking the time to try & sort me, I know most have better 
things to do.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
My views 
<http://www.armchairpatriot.com/What%20Has%20America%20Become.shtml>
All things are possible, except for skiing through a revolving door.
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
         law-abiding citizens.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web