Skip to content

[V1.4.0] run_python action fails with AttributeError: 'NoneType' object has no attribute 'flush' #340

@makiroll1125

Description

@makiroll1125

What happened:

When executing the run_python action, an unhandled internal exception is thrown: AttributeError: 'NoneType' object has no attribute 'flush'. The action fails completely, does not return execution results, and aborts the running task. This error occurs during stdout/stderr stream handling after Python code execution completes.

What I expected:

The run_python action should execute the provided Python code successfully, capture all output correctly, and return exit code / stdout / stderr results cleanly. Even when user provided code contains errors, the action should handle it gracefully and return the error output instead of crashing with an internal agent exception.

Steps to reproduce:

  1. Call the run_python action with any valid or invalid Python code snippet
  2. Observe the internal AttributeError is thrown instead of execution results
  3. Error occurs 100% consistently on all run_python invocations

Environment:

OS: Windows 11
Container OS: Linux 6.12.13

Logs:

AttributeError: 'NoneType' object has no attribute 'flush'

Consider referring to this similar issue: huggingface/diffusers#3290

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions