473,729 Members | 2,149 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(buffe r)
File "/usr/lib/python2.3/site-packages/serial/serialposix.py" , line
288, in write
n = os.write(self.f d, 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 7159
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**********@y ahoo.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(buffe r)
File "/usr/lib/python2.3/site-packages/serial/serialposix.py" , line
288, in write
n = os.write(self.f d, 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
1983
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 ______________________________________ No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced.
3
4778
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.. _________________________________________________________________ Depolama alani sikintisindan kurtulun - hemen Hotmail'e üye olun! http://odeme.hotmail.com.tr
13
11030
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 creates a "normal" comm port (like COM3). There is a C++ program that has no problem talking to the equipment, but two Python programs have trouble. One is a big, scary, controller program, and the other, since that is the one I'm having trouble...
6
17694
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 (relative humidty with ord(input)) But what im trying to do is plot the data in real time, ideally with pylab - as it looks simple to use and simple is the way i want to go! My code is below, it doesnt show a graph, I was wondering whether
15
16867
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 just a packet header) separated by spaces as follows: M xxx xxx xxx xxx xxx xxx xxx xxx Here is the code I am using (python v24): import serial
0
596
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 and found (to take with care!) :
1
15096
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 protocol. There are a few open source programs that do this already (http://romraider.com/ , http://jdash.sourceforge.net/ , http://tari.co.za/downloads/software/source/ ), but they are written in Java or C++. I have never done anything with serial...
2
4157
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 When you touch the input pins of the microcontroller the value changes real time in hyper terminal. But In the case of the pyserial module, even though you touch the input pins, the value does not change. We have actually noticed that python records and...
5
6253
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 those sensors. Based on the "commands", the sensors keep sending corresponding data back to the instrument which wraps up those data and put into "com1" . The readlines() of pyserial pick up those data for processing. The data ’string' does...
0
8913
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9280
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
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
9142
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...
1
6722
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
4525
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
3238
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
2677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2162
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.