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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:15:53+00:00 2026-06-17T09:15:53+00:00

The problem is illustrated by this simple script: import time, os, sys sys.stdout =

  • 0

The problem is illustrated by this simple script:

import time, os, sys
sys.stdout = os.fdopen( sys.stdout.fileno(), 'w', 1 ) # line-buffer stdout
print 'before sleep'
time.sleep( 10 )
print 'after sleep'

If line-buffering is successful, then there will be a 10-sec gap between the printing of the two lines. If not, both lines will appear virtually at the same time after a 10-sec pause (once Python starts up); that is, the lines are printed when the program exits.

On Linux, I see line-buffered behavior to both a file and to the screen if the “sys.stdout” line is included. Without that line, I see line-buffered behavior to the screen, but not to a file. This is expected.

In the MSYS/MINGW environment, if I omit the “sys.stdout” line, I see the same behavior as Linux: line-buffering to the screen but not to a file.

What is weird is that with the “sys.stdout” line, I don’t see line-buffering to either the screen or a file. I expect to see it to both, as in Linux.

Can anyone suggest a workaround?

Here’s a bit more information:

uname -a
MINGW32_NT-6.0 FOO 1.0.11(0.46/3/2) 2009-05-23 19:33 i686 Msys

Thanks,
-W.

  • 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-17T09:15:54+00:00Added an answer on June 17, 2026 at 9:15 am

    One of my colleagues knew the answer.

    Line buffering is not supported on WIN32. If line buffering is specified, it reverts to full buffering. Unbuffered output is available, and the workaround is to use it on WIN32. I have tried it in my simple test program, and it works.

    Ref.: http://msdn.microsoft.com/en-us/library/86cebhfs%28v=vs.71%29.aspx

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

Sidebar

Related Questions

(I have a problem that I illustrated in this question but had no correct
I got this code from a WPF (very simple) application that illustrate my problem
This is a contrived example, but it illustrates my problem much more concisely then
I'm trying to illustrate a doubly linked list problem. this is from an old
To illustrate my problem, TEST=Hi my name is John OUTP=`echo $TEST | awk '{print
Is there a solution to the problem illustrated in the code below? Start by
We're using this script -- http://jsfiddle.net/6t74T/4/ -- which we learned about in this terrific
The problem I have is as follows, and I will use simple example to
This is a real simple example, I have a basic JavaScript object with an
I am stuck on a simple yet vexing problem with basic geometry. Too bad

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.