Skip to content
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

Passing elements to pyscript.when causes ImportError in MicroPython #2062

Open
3 tasks done
kkinder opened this issue May 15, 2024 · 0 comments
Open
3 tasks done

Passing elements to pyscript.when causes ImportError in MicroPython #2062

kkinder opened this issue May 15, 2024 · 0 comments
Labels
needs-triage Issue needs triage type: bug Something isn't working

Comments

@kkinder
Copy link

kkinder commented May 15, 2024

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?

It seems that although you guys support pyscript.when with Micropython, it does not support passing a non-string element. For example:

from js import window
from pyscript import when

@when("popstate", window)
def on_popstate(event):
    pass

This results in an ImportError:

  File "pyscript/event_handling.py", line 27, in decorator
ImportError: no module named 'pyweb'

I took a look at the relevant file and it looks like there's a logic fork for non-string selectors on when, which isn't supported in Micropython.

The docs don't make that clear, however.

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

No response

Console info

PythonError: Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
  File "x/application.py", line 10, in <module>
  File "x/application.py", line 45, in Application
  File "pyscript/event_handling.py", line 27, in decorator
ImportError: no module named 'pyweb'


### Additional Context

_No response_
@kkinder kkinder added needs-triage Issue needs triage type: bug Something isn't working labels May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Issue needs triage type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant