473,769 Members | 5,173 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=BluetoothS ocket( 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 2746
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=BluetoothS ocket( 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.w eb.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=BluetoothS ocket( 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
5979
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 problem with the range Offset property, I'm not getting the correct offset and the returned range is a single cell and not the same size as the original range. For example, when I enter the following lines of code in PythonWin : from...
4
2228
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 Python-2.3.4.exe, I next executed: > pywin32-201.win32-py2.3.exe as downloaded from SourceForge, in the belief that it was the appropriate companion for Python-2.3.4 (perhaps this is my mistake?). In both cases, the installed Pythonwin outputs the...
4
1887
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 libraries, but I ran into an issue supporting optional parameters. After a lot of digging I discovered that the old CreateTypeLib API doesn't support them. I have currently built a custom version of pywin32 that uses the new CreateTypeLib2 API, and...
0
1210
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 202 -> which version wxWindows -> which version pysqlite -> which version which version to use so this will work on windows 95. i know that win95 is no longer supported but there must be previous version
1
6632
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, when I run 'python setup.py' in my PyWin32 directory, I have two problem : the version indacated in windows.h and some symbols who are not defined. See the trace :
18
2036
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, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet ""I do not fear death. I had been dead for billions and billions of years before I was born, and had
7
4499
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.0, does it means that: - my script using pywin32 for the COM layer and scipy for the maths won't work under 3.0
3
4163
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 it would sure be nice to have an interpreter I can type a few lines of code into and test things. (1) Would CPython be a good choice for this? How about iron python? How about Jython (probably not). (2) What about callbacks? Which pythons can...
2
5299
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 charm in cygwin, but when I try to use it directly in python under windows using active state python installation, it says it's missing the module win32file.
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.