-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Can't disable stderr DOM redirection #2220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
just FYI I am not sure that final |
The MR version has been published as |
The Pyodide backend now works as expected with those changes. The Micropython backend also correctly outputs text, rather than ASCII codes when writing to the DOM. However, under Safari (17.6, under macOS 14.7), when I use a
it works, but logs the following:
I get this error twice if I use MicroPython and an external configuration file:
where
This error doesn't occur under Chrome (129.0.6668.101) |
One other note that I mentioned in Discord, but mentioning it here for posterity: The existence of the |
@freakboy3742 I have created a live example of your code and I cannot see any error whatsoever in there in WebKit (stable VS dev channel) https://pyscript.com/@agiammarchi/aged-frost/latest?files=main.py,index.html edit yes, there are errors but those are not related to our code, rather PyScript .com concerns, nothing about the error moreover, at position 419 the variable is the We know about the documentation, it was "lost in translation" and I am bringing it back as we speak, thanks for pointing that out in both places though, appreciated! |
Re-opening as the closing was done automatically from the MR + just FYI there is a new MR around plugins in our docs: pyscript/docs#146 edit if you can confirm everything is fine and you are happy now about the current state around |
@freakboy3742 at line: there is that hooks are exported by core: hooks are imported in core:
I have some issue understanding how come everything works but you have an error in a crucial part of the logic ... and I've read this 3 times already and there is nothing that is not defined in here https://github.com/pyscript/pyscript/blob/main/core/src/plugins/error.js could you please write down the exact string returned by |
Full version from the About screen is Version 17.6 (19618.3.11.11.5), on macOS 14.7 (23H124). |
I have no promise error whatsoever ... is there any chance you either are importing PyScript twice or your cache is playing some weird trick? @ntoll would you see a Promise error in this page with Safari? https://pyscript.com/@agiammarchi/aged-frost/latest?files=main.py,index.html |
@WebReflection here's what I see in my console: ![]() Note the promise rejection error that I expanded. |
if you use https://cdn.jsdelivr.net/npm/@pyscript/core@0.6.12/dist/core.js instead of current generic one, unless jsdelivr already did catch up, you won't see that error anymore. It's a horror story suitable for these days of the year but basically it got, eventually, fixed, and it's a Safari JS modules' resolution issue no other browser has so that an asynchronous operation in one import resolves before the importer gets a chance to use that code, and I am trying to recreate a minimal viable issue to file a proper bug at Safari / WebKit folks, although WebKit has no such issue whatsoever. |
Can confirm that version of the script no longer raises the error. Thanks for the fix(es)! |
FWIW @WebReflection does a deep dive into what was going on at the start of this week's PyScript FUN video: https://www.youtube.com/watch?v=_zbM5YtKrVA |
Checklist
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 theplugins
configuration item is even supported any more - the plugins page doesn't make any mention of thepyscript.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.The text was updated successfully, but these errors were encountered: