IronLanguages / IronLanguages/ironpython3

Console.SetOut does not output print statement output

Open
#1,204 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
2.8k
Forks
316
Avg merge
1d 9h
Merged PRs (30d)
1

Description

Prerequisites

The issue tracker is used to report bugs and request new features, NOT to ask questions.

Questions should be posted to the users mailing list which can be accessed at
https://ironpython.groups.io/g/users.

  • [ X ] Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you perform a cursory search?
Description

Am using IronPython 3.4.0-alpha on c# Visual Studio project. Was previously using 2.7.9 and using RedirectToConsole() to and then setting Console.SetOut to a text writer. This used to print the output of a print statment. That now print nothing at all but no errors are generated.

Steps to Reproduce
  1. Redirect output to console with Engine.Runtime.IO.RedirectToConsole
  2. Set console output to text writer with Console.SetOut(TextWriter.Synchronized(writer [writer is a TextWriter instance])
  3. Send the python string print("Hello").
  4. Nothing appears in the TextWriter object.

Expected behavior:
Hello should have been printed in the TextWriter.

Actual behavior:
Nothing appeared in the TextWriter. This exact same code works correctly in 2.7.9.

Versions

3.4.0-alpha

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the interaction between Engine.Runtime.IO.RedirectToConsole, Console.SetOut, and the TextWriter used in the reproduction. Run the stated print("Hello") sequence on IronPython 3.4.0-alpha and compare it with 2.7.9. Done means Python print output reaches the configured TextWriter without errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.