Skip to content

Js TypeError: Cannot read properties of undefined (reading 'setAttribute') #677

@antocuni

Description

@antocuni

This is a JS error which is triggered by examples/panel_stream.html: it's very likely that it's not a bug in the example but in pyscript itself, so it should be investigated further.

See also the corresponding test in PR #676:

@pytest.mark.xfail(reason="JsError: issue #677")
def test_panel_stream(self):
# XXX improve this test
self.goto("examples/panel_stream.html")
self.wait_for_pyscript()
assert self.page.title() == "PyScript/Panel Streaming Demo"
wait_for_render(self.page, "*", "<div.*?class=['\"]bk-root['\"].*?>")

This is the full JS traceback:

base.ts:169 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'setAttribute')
    at PyScript.evaluate (base.ts:169:79)
    at async PyodideRuntime.initialize (pyconfig.ts:107:13)

NOTE: in order to properly fix this issue, a PR should:

  • add a new test minimal test (e.g. in test_01_basic.py) which showcases the problem
  • fix the bug :)
  • remove the @pytest.mark.xfail from test_panel_stream and ensure that it passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogissue has been triaged but has not been earmarked for any upcoming releaselang: typescriptRelated to the Typescript languagetype: bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions