473,406 Members | 2,439 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,406 software developers and data experts.

pyserial with binary data

Hi,

I'm using pyserial to transfer data from PC to another device - the
data is either from an ASCII file or binary data file. Everything
works fine up until I start using files of a particular size on Linux,
around 1.3MB.

When I send the data on windows everything is ok - on Linux I get the
following traceback:

Traceback (most recent call last):
....
File "/home/pythonCode/loader.py", line 155,
in serialWrite
ser.write(buffer)
File "/usr/lib/python2.3/site-packages/serial/serialposix.py", line
288, in write
n = os.write(self.fd, d)
OSError: [Errno 11] Resource temporarily unavailable

In the serialposix.py file the data is being written to the serial
port - I'm guessing that the win32 file is used when running on
windows so might be why things work ok.

Can anyone offer any pointers as to why this should happen ? I first
thought that it might be because I was using binary data, but the same
happens when I tried a large ASCII data file. Any ideas for a
workaround appreciated :)

Many thanks,

Alastair.
Jul 18 '05 #1
3 7128
Hi,

I've got the same problem. Errno 11 is because too much data, sending
is in progress.

Fix is easy: assign a non zero value to the writeTimeout property of
your serial objet.
Then the write method will wait up to this time for sending data.

Hope that's help

Guillaume
Jul 18 '05 #2
Guillaume Weymeskirch wrote:
I've got the same problem. Errno 11 is because too much data, sending
is in progress.

Fix is easy: assign a non zero value to the writeTimeout property of
your serial objet.
Then the write method will wait up to this time for sending data.


Note that writeTimeout is new in PySerial v2.1, released 2004 July 28.

-Peter
Jul 18 '05 #3
On 2004-11-26, alastair <al**********@yahoo.co.uk> wrote:
When I send the data on windows everything is ok - on Linux I get the
following traceback:

Traceback (most recent call last):
...
File "/home/pythonCode/loader.py", line 155,
in serialWrite
ser.write(buffer)
File "/usr/lib/python2.3/site-packages/serial/serialposix.py", line
288, in write
n = os.write(self.fd, d)
OSError: [Errno 11] Resource temporarily unavailable
A patch that fixes this is available from the pyserial SF site.
Can anyone offer any pointers as to why this should happen ?
It happens because the serial device driver returns -11. The
Regular serial (16x50) driver doesn't do this and will buffer
up to 4K, then block. For reasons known only to their authors,
some serial drivers don't behave like that. If you try to
write more than they can immediately send to the HW (a dozen or
two bytes in the case I ran across with a Prolific USB->serial
widget), they take as much as they can send and return
immediately. If you then try to write more data, you get a
return of -11.
I first thought that it might be because I was using binary
data, but the same happens when I tried a large ASCII data
file. Any ideas for a workaround appreciated :)


Here's the bug:
http://sourceforge.net/tracker/index...87&atid=446302
Here's the patch:
http://sourceforge.net/tracker/index...87&atid=446304

--
Grant Edwards grante Yow! TATTOOED MIDGETS
at are using ALFREDO in their
visi.com SALAMI FACTORY!
Jul 18 '05 #4

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

Similar topics

1
by: Kelia Nichols | last post by:
Hello, I am using Pyserial to work with a RS232 device. My question is, how do I write hex to the device or cannot write hex to it pyserial? Kelia Nichols...
3
by: ouz as | last post by:
hi, I want to transfer 0 bit and 1 bit in order with pyserial.But pyserial only send string data. Can anyone help me? Sorry about my english.. ...
13
by: Bob Greschke | last post by:
We have some equipment that communicates at 57600 baud RS232. The path from the PC is USB to a Phillips USB hub, then off of that a TUSB3410 USB/Serial converter. The driver for the 3410 chip...
6
by: googlinggoogler | last post by:
Hiya, I've got a PIC microcontroller reading me humidity data via rs232, this is in ASCII format. I can view this data easily using hyperterminal or pyserial and convert it to its value...
15
by: Lone Wolf | last post by:
I'm trying to get data through my serial port from a CMUcam. This gizmo tracks a color and returns a packet of data. The packet has nine data points (well, really eight since the first point is...
0
by: pauland80 | last post by:
<snip> <snip> Late thanks for your both answers! (Please excuse me for that) The problem was a bug in the device firmware. But before finding this, I dugg lightly in the pyserial source...
1
by: Rich | last post by:
Hello, I am working on a python library for sending and receiving data from a Subaru's ECU (the fuel injection computer) via the OBD-II port and an OBD to USB cable, with the Subaru Select Monitor...
2
by: bryanleo | last post by:
We are trying to read data from a microcontroller and interface it through serial port. The output is then displayed in Python using Pyserial or the hyperterminal, the former is more important ...
5
by: zxo102 | last post by:
Hello All, I have a system. An instrument attched to 'com1' is wireless connected to many sensors at different locations. The instrument can forward the "commands" (from pyserial's write()) to...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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...
0
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...
0
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,...
0
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...

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.