How can I simplify relative paths in code cells? #12478
-
| DescriptionI would like to keep all data files in one place at the root of my project. How can I reference this data from code cells in deeply nested quarto documents while avoiding paths like  For live code cells such as pyodide, I've noticed that a good workaround is to specify the data via the  An example project
 project:
  type: website
  render:
    - modules
resources:
  - data  # It would be great if this also worked for regular code cells
 ---
title: "Quarto Python Data Example"
format: live-html
---
## Test resource paths
```{pyodide}
# pyodide
import os
os.listdir('.')
```
```{python}
# python
import os
os.listdir('.')
```With this setup, the  | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
| Use the environment variables  | 
Beta Was this translation helpful? Give feedback.

Thanks @cderv, it seems like that option is working as expected for code cells! Now I have the following in my
_quarto.yml:I noticed that neither of these options seem to affect the paths of figures/images inside
.qmdfiles, which still use relative references. I initially thought this would be the case when changing the working directory, but I realize it is only the execution / computation that is affected, wh…