jupyterlab-contrib / jupyterlab-filesystem-access

[Experimental] Browse local files using the non-standard File System Access API
https://jupyterlab-filesystem-access.readthedocs.io
BSD 3-Clause "New" or "Revised" License
30 stars 6 forks source link

Reading files from code #64

Open psychemedia opened 1 month ago

psychemedia commented 1 month ago

If I mount a file system directory, open a notebook in that context, and then try to read a file in that context, e.g. using pandas I get a file not found error.

Is there a way of setting a path either to a file in the file system directory, or a path to a file in the default file system (the browser file directory context, not the shared file-system-access context) when working on a notebook in the shared file-system context?

martinRenou commented 1 month ago

Thanks for opening an issue.

Are you talking about a JupyterLab context or a JupyterLite context?

psychemedia commented 1 month ago

JupyterLab ("full" server). Ok - so jupyterlab-filesystem-access is purely a UI tool in the browser, rather than a mount, although changes made to files in the UI will be saved back to the desktop.

FWIW, the use case is an educational environment, where students are accessing a remote server, The remote server does have file persistence, but it is also useful for students to have local copies of their files. Being able to access and run local files using the remotely served UI is really useful.

I suppose a workaround is for students to mirror data files by uploading them to the remote server, the kernel presumably seeing that file system as code is executed.

I guess another solution might be to upload eg data files that are intended to be read from executed code to a temporary directory on the server? Or maybe changing the background to a file listed in the jupyterlab-file-system-access file listing if a file of the same name exists the current directory path as seen on the server and as such was readable from code?