473,395 Members | 1,383 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 :
http://www.generation-nt.com/reponse...de-142097.html
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 ?
Sep 3 '08 #1
4 2720
I tried under Linux... same problem.
So... it may comes from my little lines of code... or from my GPS.
Sep 3 '08 #2
Xavier schrieb:
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 :
http://www.generation-nt.com/reponse...de-142097.html
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
Sep 3 '08 #3
On 3 Sep, 16:33, "Diez B. Roggisch" <de...@nospam.web.dewrote:
Xavier schrieb:
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 :
http://www.generation-nt.com/reponse...de-142097.html
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
Could be hardware flow control. See this sometimes on the bluetooth
connections that are using Serial Port Protocol and the hardware flow
control hasn't been physically implemented.

Do you lose data after exactly the same amount of data has been
received?
Sep 4 '08 #4
Hi

I have resolved my problem by checking paquets.
It seems that it is a problem of the GPS (it's a very cheap GPS
Datalogger).
Could be hardware flow control. See this sometimes on the bluetooth
connections that are using Serial Port Protocol and the hardware flow
control hasn't been physically implemented.
It seems it is the problem.
The policy seems to be :
- ask the GPS for the data
- touch wood
- retry with the missing chunks
Even the official driver is doing this.
Do you lose data after exactly the same amount of data has
been received?
Not. The lost are randomized but it's chunks, ex :
300 consecutive bytes ok
30 consecutive bytes lost
250 bytes ok
40 bytes lost
800 bytes ok
50 bytes lost
....
Sep 15 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Michael Jordan | last post by:
I'm hoping that someone here can give me some insight into a problem I'm running into with Python, pywin32 and Excel. All-in-all using Python and pywin32 is great but I've run into a strange...
4
by: Bob Chapman | last post by:
On two different Windows 98SE Systems, I have attempted to upgrade working Python 2.3.3 and win32all installations to Python 2.3.4. After what appeared to be successful installations of...
4
by: Philip Rittenhouse | last post by:
I was just wondering if there are any plans to support the CreateTypeLib2 API either instead of, or in addition to, the CreateTypeLib API. I am currently using pythoncom to generate type...
0
by: Aljosa Mohorovic | last post by:
which is last pywin32 that works on win95? i need it to access COM object and it needs to run on win95. version fox this mix would be nice, something like: python 2.3.4 -> which version pywin32 b...
1
by: mg | last post by:
Hi all, I have reinstalled my Win32 computer last week and I did an update of the project PyWin32 to complete my Python installation. (I have to use sources from CVS for my project !) So,...
18
by: W. Watson | last post by:
What do I download to use Python with MX XP Pro on an ASUS 4 year old motherboard? I would guess a good book source for starters would be the O'Reilly book. Wayne T. Watson (Watson Adventures,...
7
by: vml | last post by:
Hello, I am trying to promote python in my job, my collegue only see matlab and microsoft scripting language. I understood that there willl be no backward compatibility between python 2.x and...
3
by: Siegfried Heintze | last post by:
I need to understand some User32.dll functions and I'm making an elaborate GUI so I can easily experiment with different parameters. This is taking a long time. I'm new to python and I'm thinking...
2
by: Holger | last post by:
Hi I'm using python Serial from: http://switch.dl.sourceforge.net/sourceforge/pyserial/pyserial-2.4.tar.gz to implement ymodem and other protocols on the PC com port And it works like a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.