You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to access a directory via the resources option in the yaml header. I have a directory called /opt/project/testdata with one file called blah.txt and I have this quarto file
---title: Real data examplesformat: live-htmlpyodide:
resources:
- "/opt/project/testdata"---```{pyodide}from os import listdirprint(listdir("testdata"))```
When I try to run the file, I get an error:
Pyodide appears to see the directory I specified because it sees the blah.txt file, but then gets an error trying to load it. I'm using quarto 1.6.40 with the quarto preview command. I checked the file permissions, and everything is wide open (ubuntu). I'm not entirely sure how pyiodide plays with quarto preview. I have quarto render to the default _site directory. Is there some issue related to the render output directory? The testdata directory is not copied there.
The text was updated successfully, but these errors were encountered:
I've done some more digging into this. It appears when the qmd file is in a subdirectory of the project and the data directory is relative to the project root, you have to specify the path using something like ../data. Often in quarto you can specify the path relative to the project root with something like /data
If the quarto file and the resource directory are both at the top level of the project, everything works.
So, I don't know if this is a bug per se, but it would be nice for the path to be relative to the project. At the very least, I think this should be a documentation update, and I'm willing to help on the documentation if that seems like the best way to go.
Hi, thanks for your work debugging this and replying with further updated information.
I think your suggestion of supporting paths with a leading slash as relative to the project root is a good idea, particularly if it matches other existing behaviour in Quarto.
In the shorter term I'm happy to accept documentation PRs, we can always revert them once the correct functionality has been implemented.
I'm trying to access a directory via the
resources
option in the yaml header. I have a directory called /opt/project/testdata with one file called blah.txt and I have this quarto fileWhen I try to run the file, I get an error:
Pyodide appears to see the directory I specified because it sees the blah.txt file, but then gets an error trying to load it. I'm using quarto 1.6.40 with the quarto preview command. I checked the file permissions, and everything is wide open (ubuntu). I'm not entirely sure how pyiodide plays with quarto preview. I have quarto render to the default
_site
directory. Is there some issue related to the render output directory? Thetestdata
directory is not copied there.The text was updated successfully, but these errors were encountered: