Grant Edwards
1/24/2008 4:56:00 PM
On 2008-01-24, JAMoore84@gmail.com <JAMoore84@gmail.com> wrote:
> Hi Guys,
>
> I have a project where I'd like to save GPS data that is streamed to a
> Sony Vaio over bluetooth. I can monitor the data stream over Hyper
> Terminal, but I'd like to use python to capture it as well. I've
> installed Python 2.5, pyserial 2.2 and the appropriate pywin program
> (pywin32-210.win32-py2.5.exe).
>
> My problem comes when I try to open a serial port. After importing
> "serial", I issue the following statement:
>
>>>> GPS = serial.Serial(0)
>
> Traceback (most recent call last):
> File "<pyshell#3>", line 1, in <module>
> GPS = serial.Serial(0)
> File "C:\Python25\lib\site-packages\serial\serialutil.py", line 156,
> in __init__
> self.open()
> File "C:\Python25\lib\site-packages\serial\serialwin32.py", line 55,
> in open
> raise SerialException("could not open port: %s" % msg)
> SerialException: could not open port: (2, 'CreateFile', 'The system
> cannot find the file specified.')
>
> I'm not sure where the source of the problem is. I was
> wondering if someone could recognize what might be be.
It's Windows... it's not expected to work. ;)
My guess is that for whatever reason the 'first' serial port
(which is what you're asking for by specifying a 0 when
instantiating the Serial class) doesn't actually exist. Serial
device names under Windows are broken. Just because you have
only one serial port, it doesn't mean that serial port is the
first serial port.
Try using the actual name of the com port (e.g. 'COM3' or
'COM5') instead of 0.
Oh, if you end up having to use a com port higher than COM9,
that's broken in Windows as well, and you've got to sprinkle a
bunch of backslashes into the device name (I don't remember the
exact syntax).
--
Grant Edwards grante Yow! ... this must be what
at it's like to be a COLLEGE
visi.com GRADUATE!!