- Notifications
You must be signed in to change notification settings - Fork752
Closed
Description
Environment
- Pythonnet version: 2.2.2 (.NET 4, x64)
- Python version: 3.5
- Operating System: Windows 10
Details
Python is embedded in my .NET application using pythonnet. I found the output of the print statement in a python script is not showing on the screen until a "sys.stdout.flush()" called. I don't known how to redirect sys.stdout in .NET.
In order to call the flush() method directly in .NET, I tried
dynamicsys=PythonEngine.ImportModule("sys");varstdout=sys.GetAttr("stdout");// returns None
and both sys.stdout and the variable stdout returned are None here.
In python, I tried
importsysprint(getattr(sys,'stdout'))
and it outputs a_io.TextIOWrapper
object.
Why sys.stdout returned null here? How to make the output of python print statement show automatically?
Thanks.
Metadata
Metadata
Assignees
Labels
No labels