Re: i want to add a timeout to my code



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:
> 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?

Yeah I'm using Windows 2000.

signal doesn't work on Windows. The timeout parameter to Serial should suffice...

--
Gabriel Genellina

.



Relevant Pages

  • Re: usb GPS device autodetects as mouse
    ... I have a USB GPS device that I am using in windows XP, ... it appears to Windows as a serial port. ...
    (microsoft.public.windowsxp.general)
  • Re: USB newbie: many questions (driver, class, etc.)
    ... that we could use Communication class (CDC) with Data ... windows creates a virtual COM port on its own (using ... but Windows 2000 Pro ... > GPS does not, but almost every single GPS application does. ...
    (microsoft.public.development.device.drivers)
  • Re: Garman GPS II
    ... Are you using a USB to COM port adapter? ... What's happening if that, when Windows detects a new COM port added, it runs ... your GPS unit is actual a serial mouse and your cursor starting going crazy! ...
    (sci.geo.satellite-nav)
  • Re: best gps receiver for time synchronization
    ... I am trying to sync my Windows box to an external GPS source. ... I recently wanted to add a serial feed to a PC but, like your PC, there was no serial port. ... As to accuracy, I've been helping Dave Hart test a new NTP port for Windows, and on my PC I'm seeing reported offsets typically less than 300 microseconds from a serial and PPS GPS device, and there is strong evidence that the variations are temperature related, as the PC is in a domestic environment, and the reported offset correlates well with the ambient temperature. ...
    (comp.protocols.time.ntp)
  • ahci(4) breaks on MSI X58 Pro-E
    ... cpu0: <ACPI CPU> on acpi0 ... ahcich0: Timeout on slot 17 port 0 ...
    (freebsd-current)