'Iterate over files in GitHub repo from a Jupyter Notebook inside the repo
I have this folder in my GitHub repo:
Inside this repo, I have a Jupyter notebook, and I use MyBinder to render this notebook into a web app. Inside the notebook, I iterate over the files in the rasters_as_int folder and extract the date from the file name. All the files have the same name pattern, for example, one of the files is named: MODAL2_M_CLD_FR_2019-06-01_rgb_3600x1800.FLOAT.TIFF.
In the previous version of the repo, there was no folder and all these files were on the repo "main page" (sorry if this is not the proper name for it), so in the notebook, I used the glob package to iterate over them (and extract the date using Python split method):
rasters_list = glob.glob('*TIFF*')
And it works perfectly.
However, I can't seem to find how to iterate when these files are in the rasters_as_in folder.
I tried many options but nothing seems to work:
rasters_list = glob.glob('rasters_as_int/*TIFF*')
rasters_list = glob.glob('/rasters_as_int/*TIFF*')
rasters_list = glob.glob('./rasters_as_int/*TIFF*')
rasters_list = glob.glob('rasters_as_int\\*TIFF*')
rasters_list = glob.glob('\\rasters_as_int\\*TIFF*')
rasters_list = glob.glob('.\\rasters_as_int\\*TIFF*')
rasters_list = glob.glob('rasters_as_int/*')
rasters_list = glob.glob('/rasters_as_int/*')
rasters_list = glob.glob('./rasters_as_int/*')
rasters_list = glob.glob('.\\rasters_as_int\\*')
rasters_list = glob.glob('/rasters_as_int/*',recursive=True)
Solution 1:[1]
You need to pass data through the broadcaster, but what you write about your attempts makes me suspect that you've been trying to pass UI components (i.e. instances of com.vaadin.flow.component.html.Image). That won't work because a UI component instance cannot be attached to multiple locations (i.e. multiple browser windows in this case) at the same time.
What you can try is to pass the data (e.g. a String with the image URL) through the broadcaster and then let each subscriber create their own Image component based on the data that they receive.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Leif Åstrand |

