Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Python

Serial I/O problem with pywin32 ?

 
Jump to:  
 
Xavier
PostPosted: Wed Sep 03, 2008 9:44 am    Post subject: Serial I/O problem with pywin32 ?
       
Hi,

I try to access to a Bluetooth GPS data-logger with Python. I use
pySerial.

Sending and receiving little messages (~100 char) works fine. However,
when I ask the GPS to dump the trails, it returns some Mbytes and here
is the problem : in the stream of bytes, I randomly losts chunks of
~100bytes.

I tried USPP and pyBlueZ instead of pySerial : same problem.

It doesn't like it is a bufferoverun bug from me because :
- the GPS seems to wait when I do not read the stream,
- there is never more than 200 inWainting() characters,
- my code to test it is quite simple :

seriallink = serial.Serial("COM40")
fileName = "data.dump"
out = open(fileName, 'w')
while 1:
c = seriallink.read()
out.write(" %0.2X" % ord(c))
print "*",
out.close()

(with pyBluez :
sock=BluetoothSocket( RFCOMM )
sock.connect(("00:0A:...", 1)))

I tried my program on two different PC with two Bluetooth dongle,
(with pySerial, USPP, pyBluez).
The same things are :
- windows
- the GPS (which works fine with the dumper program of the
constructor)
- pyWin32

I've found another guy with a similar problem :
LINK
He says:
- no problem with little messages
- lost of one byte every hour when receiving a lot of data

Any known problems with pywin32 and serial I/O when downloading a big
stream of data ?
 

 
Diez B. Roggisch
PostPosted: Wed Sep 03, 2008 1:33 pm    Post subject: Re: Serial I/O problem with pywin32 ?
       
Xavier schrieb:
Quote:
Hi,

I try to access to a Bluetooth GPS data-logger with Python. I use
pySerial.

Sending and receiving little messages (~100 char) works fine. However,
when I ask the GPS to dump the trails, it returns some Mbytes and here
is the problem : in the stream of bytes, I randomly losts chunks of
~100bytes.

I tried USPP and pyBlueZ instead of pySerial : same problem.

It doesn't like it is a bufferoverun bug from me because :
- the GPS seems to wait when I do not read the stream,
- there is never more than 200 inWainting() characters,
- my code to test it is quite simple :

seriallink = serial.Serial("COM40")
fileName = "data.dump"
out = open(fileName, 'w')
while 1:
c = seriallink.read()
out.write(" %0.2X" % ord(c))
print "*",
out.close()

(with pyBluez :
sock=BluetoothSocket( RFCOMM )
sock.connect(("00:0A:...", 1)))

I tried my program on two different PC with two Bluetooth dongle,
(with pySerial, USPP, pyBluez).
The same things are :
- windows
- the GPS (which works fine with the dumper program of the
constructor)
- pyWin32

I've found another guy with a similar problem :
LINK
He says:
- no problem with little messages
- lost of one byte every hour when receiving a lot of data

Any known problems with pywin32 and serial I/O when downloading a big
stream of data ?

From my experience with serial lines I'd say: that's the culprit. They
tend to be rather unreliable, as there is no real protocol ensuring data
integrity.

You might consider downloading chunks of data if that's somehow
possible, and re-try failed chunks.

Diez
 

 
Xavier
PostPosted: Wed Sep 03, 2008 3:25 pm    Post subject: Re: Serial I/O problem with pywin32 ?
       
I tried under Linux... same problem.
So... it may comes from my little lines of code... or from my GPS.
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

grecja laptopy asus Moje jedyne marzenie - Anna Jantar rodos last minute Czarny chleb - Dżem