Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

stdout

Redirect stdout to a file in Python?

August 22, 2022 by Magenaut

How do I redirect stdout to an arbitrary file in Python?

Categories Python, Q&A Tags python, stdout Leave a comment

Disable output buffering

August 22, 2022 by Magenaut

Is output buffering enabled by default in Python’s interpreter for sys.stdout?

Categories Python, Q&A Tags buffered, python, stdout Leave a comment

Setting the correct encoding when piping stdout in Python

August 21, 2022 by Magenaut

When piping the output of a Python program, the Python interpreter gets confused about encoding and sets it to None. This means a program like this:

Categories Python, Q&A Tags encoding, python, python-2.x, stdout, terminal Leave a comment

Can I redirect the stdout into some sort of string buffer?

August 21, 2022 by Magenaut

I’m using python’s ftplib to write a small FTP client, but some of the functions in the package don’t return string output, but print to stdout. I want to redirect stdout to an object which I’ll be able to read the output from.

Categories Python, Q&A Tags python, redirect, stdout, stream Leave a comment

How to set sys.stdout encoding in Python 3?

August 21, 2022 by Magenaut

Setting the default output encoding in Python 2 is a well-known idiom:

Categories Python, Q&A Tags python, python-3.x, stdout, unicode Leave a comment

How to capture stdout output from a Python function call?

August 20, 2022 by Magenaut

I’m using a Python library that does something to an object

Categories Python, Q&A Tags capture, python, stdout Leave a comment

Temporarily Redirect stdout/stderr

August 20, 2022 by Magenaut

Is it possible to temporarily redirect stdout/stderr in Python (i.e. for the duration of a method)?

Categories Python, Q&A Tags python, redirect, stderr, stdout Leave a comment

Capture stdout from a script?

August 19, 2022 by Magenaut

suppose there is a script doing something like this:

Categories Python, Q&A Tags python, stdout, sys Leave a comment

How to open every file in a folder

August 19, 2022 by Magenaut

I have a python script parse.py, which in the script open a file, say file1, and then do something maybe print out the total number of characters.

Categories Python, Q&A Tags file, pipe, python, stdin, stdout Leave a comment

Displaying subprocess output to stdout and redirecting it

August 19, 2022 by Magenaut

I’m running a script via Python’s subprocess module. Currently I use:

Categories Python, Q&A Tags python, stdout, subprocess Leave a comment
Older posts
Page1 Page2 … Page5 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress