Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

why sys.stdout returned null #370

Closed
@yagweb

Description

@yagweb

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp