Re: i want to add a timeout to my code
- From: "Gabriel Genellina" <gagsl-py2@xxxxxxxxxxxx>
- Date: Fri, 02 May 2008 15:49:47 -0300
En Thu, 01 May 2008 17:06:20 -0300, maehhheeyy <maehhheeyy@xxxxxxxxx> escribió:
On Apr 29, 3:29 pm, John Krukoff <jkruk...@xxxxxxxx> wrote:On Tue, 2008-04-29 at 14:47 -0700, maehhheeyy wrote:Yeah I'm using Windows 2000.
> On Apr 17, 4:24 pm, Miki <miki.teb...@xxxxxxxxx> wrote:
> > On Apr 17, 1:10 pm,maehhheeyy<maehhhe..@xxxxxxxxx> wrote:
> > > I want to add a timeout so that when I pull out my gps from my serial
> > > port, it would wait for a bit then loop and then see if it's there. I
> > > also want to add a print statement saying that there is no GPS device
> > > found. However when I run my code and unplug my serial port, my code
> > > will just hang until I plug it back in.
> > > This is my code right now:
> > > def GetGPS():
> > > data = []
> > > #Open com1: 9600,8,N,1
> > > fi = serial.Serial(0, timeout = 1)
> > > print '[gps module] SERIAL PORT OPEN ON COM1:'
> >http://docs.python.org/lib/node545.html
> I tried the code onto my codes but what came out was that in the line
> signal.signal(signal.SIGSLRM, handler), an attributeError appeared
> reading that 'module' object has no attribute 'SIGALRM'
> --
Are you writing your program on windows, or some other platform which is
not unix?
signal doesn't work on Windows. The timeout parameter to Serial should suffice...
--
Gabriel Genellina
.
- References:
- Re: i want to add a timeout to my code
- From: maehhheeyy
- Re: i want to add a timeout to my code
- Prev by Date: Re: Pyserial - send and receive characters through linux serial port
- Next by Date: Searching and replacing text ?
- Previous by thread: Re: i want to add a timeout to my code
- Next by thread: Re: send gpg encrypted emails (properly mime formatted)
- Index(es):
Relevant Pages
|