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 6104151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:48:33+00:00 2026-05-23T13:48:33+00:00

When running svndumpfilter2 on Windows, I get a problem that seems to take its

  • 0

When running svndumpfilter2 on Windows, I get a problem that seems to take its origin in the fact that the dump file has sometimes CRLF endings.

Some files in the SVN database had CRLF line endings. But it seems that Python counts CRLF as one character (not counting the CR character as separate from the following LF in the content of the files). Thus, it fails read the right amount of characters, and misses the start of the next lump.

So my question is: how to tell Python to treat CRLF as two separate characters?

The stream is read from sys.stdin so I’m looking for a way to change the newline property of stdin. What is the “one right way” to do that in Python?

  • 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-05-23T13:48:34+00:00Added an answer on May 23, 2026 at 1:48 pm

    Update: One way that occurs to me is to explicitly set the mode of stdin to binary. So something like the following will read CRLF as two characters:

    import msvcrt, os, sys
    
    msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
    while True:
        ch = sys.stdin.read(1)
        print ord(ch)  # CRLF should appear as 13 followed by 10
    

    Another way is to start python with the -u flag which results in a unbuffered stdin (as well as stdout and stderr). So just python -u myscript.py where myscript.py calls stdin.read(1) with no other changes. See python --help for more information on this.

    Old: If you’re on windows, Python should be able to handle this without any intervention when you call sys.stdin.readline (or simply iterate over sys.stdin which is a file like object). Are you using sys.stdin.read instead? If so, you need to handle that case yourself.

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

Sidebar

Related Questions

Running into a problem where on certain servers we get an error that the
running sqlbulkcopy in c# and I get an error: WriteToServer: Connection property has not
running git instaweb in my repository opens a page that says 403 Forbidden -
Running FxCop on my code, I get this warning: Microsoft.Maintainability : 'FooBar.ctor is coupled
Running ipconfig /all shows a Teredo Tunneling Pseudo-Interface. What is that? Does this have
Running IIS5 (yes, really). I'd like to remove the eTag http header that IIS
Running into a problem. I have a table defined to hold the values of
Running an MVC web site that calls a WCF service. Site and service on
Running Windows PHP 4.4.2 \cli\php.exe fails with an error Cannot find php4ts.dll if the
Running node-waf with --verbose shows it uses g++ with -g . It seems to

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.