Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Can't disable stderr DOM redirection #2220

@freakboy3742

Description

@freakboy3742

Checklist

  • I added a descriptive title
  • I searched for other issues and couldn't find a solution or duplication
  • I already searched in Google and didn't find any good information or help

What happened?

In the version of PyScript served by latest/pyscript.net, both stdout and stderr content is sent to the Javascript console.

In releases/2024.10.1/core.js, stdout and stderr is sent to the Javascript console - but stderr content is also sent to the DOM as red text in a pink box.

This appears to be the expected default behaviour; however, there doesn't appear to be a way to turn this behavior off. I've seen several references to an error plugin in older versions of the docs, along with instructions for how to disable that plugin; but the 2024.10.1 docs don't seem to mention this plugin or disabling it. It's not even clear if the plugins configuration item is even supported any more - the plugins page doesn't make any mention of the pyscript.toml configuration item that previously existed.

Making matters worse; the default stderr error handling on Micropython doesn't output text, but the ASCII values of any content printed to stderr, as one integer value per line (i.e., print("This is an error", file=stderr) generates a 16 DOM boxes containing "84", "104", "105", "115", "32", ...)

What browsers are you seeing the problem on? (if applicable)

Chrome, Safari

Console info

No response

Additional Context

Reproduction case: https://gist.github.com/freakboy3742/ed3073fcffd6d92bb374bcf85301f320

I discovered this in the context of BeeWare; Toga invokes warnings.warn() for some unimplemented features, which outputs to stderr by default. Third party libraries also frequently raise warnings as part of a migration process. Having those warnings surface on the DOM is undesirable from our perspective.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions