Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8705099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:16:19+00:00 2026-06-13T03:16:19+00:00

I am using python 2.7.2 with pyserial 2.6. What is the best way to

  • 0

I am using python 2.7.2 with pyserial 2.6.
What is the best way to use pyserial.readline() when talking to a device that has a character other than “\n” for eol? The pyserial doc points out that pyserial.readline() no longer takes an ‘eol=’ argument in python 2.6+, but recommends using io.TextIOWrapper as follows:
ser = serial.serial_for_url(‘loop://’, timeout=1)
sio = io.TextIOWrapper(io.BufferedRWPair(ser, ser))

However the python io.BufferedRWPair doc specifically warns against that approach, saying “BufferedRWPair does not attempt to synchronize accesses to its underlying raw streams. You should not pass it the same object as reader and writer; use BufferedRandom instead.”

Could someone point to a working example of pyserial.readline() working with an eol other than ‘eol’?

Thanks,
Tom

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:16:21+00:00Added an answer on June 13, 2026 at 3:16 am

    read() has a user-settable maximum size to the data it reads(in bits), if your data strings are a predictable length you could simply set that to capture a fixed-length string. it’s sort of ‘kentucky windage’ in execution but so long as your data strings are consistent in size it won’t bork.

    beyond that, your real option is to capture and write the data stream to another file and split out your entries manually/programatically.

    for example, you could write your datastream to a .csv file, and adjust the delimiter variable to be your EoL character.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Python, what's the most efficient way to switch the positions of every other
Using Python I need to insert a newline character into a string every 64
I am using Python 2.7.2 with Pythonbrew and I want to use buildout for
Using Python I want to create a symbolic link pointing to a path that
Using python I'm parsing several strings. Sometimes the string has appended several semicolons to
Using Python, what's the correct way to set a file to be read-only when
When using Python is it possible that a dict can have a value that
Using Python to append CSV file, I get data every other row. How do
I am using python's pySerial library to communicate to a machine (lunar photometer if
Using Python 2.6, is there a way to check if all the items of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.