Skip to content

Error still with non-DOMWidget widgets #139

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

Closed
kylebarron opened this issue Mar 6, 2024 · 4 comments
Closed

Error still with non-DOMWidget widgets #139

kylebarron opened this issue Mar 6, 2024 · 4 comments

Comments

@kylebarron
Copy link

  • shinywidgets version: 0.3.1
  • Python version: 3.11.4
  • Operating System: macOS 14.2.1

Description

I'm trying to run the example I proposed in #133 but it still isn't working for me. In particular, I can see a map render when I

Working:
image

Not working:
image

If I look at the browser console, I see a few errors:
image

What I Did

In this PR https://github.com/developmentseed/lonboard/pull/409/files I have a lockfile (you need to be on Poetry >=1.8) and minimal reproducible example. If you comment out the def layer block, the map will render; otherwise it'll fail with a blank screen.

@cpsievert
Copy link
Collaborator

Does the example work for you with the pypi release of lonboard? It does for me, but then when I try with the latest Ionboard (developmentseed/lonboard@015672d) I'm seeing the error below, which is getting thrown by anywidget.

  File "/Users/cpsievert/github/py-shinywidgets/sandbox/reprex/app.py", line 2, in <module>
    from lonboard import Map, ScatterplotLayer
  File "/Users/cpsievert/anaconda3/lib/python3.10/site-packages/lonboard/__init__.py", line 16, in <module>
    from ._map import Map
  File "/Users/cpsievert/anaconda3/lib/python3.10/site-packages/lonboard/_map.py", line 48, in <module>
    class Map(BaseAnyWidget):
  File "/Users/cpsievert/anaconda3/lib/python3.10/site-packages/traitlets/traitlets.py", line 967, in __new__
    return super().__new__(mcls, name, bases, classdict)
  File "/Users/cpsievert/anaconda3/lib/python3.10/site-packages/anywidget/widget.py", line 66, in __init_subclass__
    file_contents = try_file_contents(getattr(cls, key))
  File "/Users/cpsievert/anaconda3/lib/python3.10/site-packages/anywidget/_util.py", line 258, in try_file_contents
    raise FileNotFoundError(f"File not found: {path}")
FileNotFoundError: File not found: /Users/cpsievert/anaconda3/lib/python3.10/site-packages/lonboard/static/index.js

I have a hunch that this error means that Ionboard doesn't work with the latest anywidget because Ionboard is doing something non-standard with its static assets, and also that, shinywidgets is failing to render for similar reasons. Hopefully, if Ionboard addresses that issue with anywidget, it'll also fix the shinywidgets issue.

@kylebarron
Copy link
Author

It does for me, but then when I try with the latest Ionboard (developmentseed/lonboard@015672d) I'm seeing the error below, which is getting thrown by anywidget

That's because you need to build the JS parts from source as well, see https://github.com/developmentseed/lonboard/blob/main/DEVELOP.md#javascript

@kylebarron
Copy link
Author

kylebarron commented Mar 19, 2024

It turns out that it works from the command line with poetry run shiny run app.py when viewed in Chrome; it just fails with the Shiny vscode extension with Shiny: Run Shiny App. I don't know where a relevant issue for that would be.

@kylebarron
Copy link
Author

In case it's useful, here's what I see in vscode:

Screen.Recording.2024-03-19.at.5.52.35.PM.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants