Open caldwellst opened 4 months ago
Hi,
Thanks for the detailed error description! Unfortunately I am completely unable to reproduce this issue… I’ve attached a video where I am running your example as closely as I can reproduce it, including using an ‘renv’ environment.
https://github.com/user-attachments/assets/b9e728d4-65a5-4b3f-a0f2-6332c66e0378
Error description
When interactively developing in RStudio, I often might run selections of code by running line by line or highlighting a section to run with
cmd + enter
or theRun
button. This occasionally generates errors when runningbox::use(local/module)
, even though the relative sourcing is correct. Below is an example with two modulesa
andb
in the same directory:a.R
b.R
If I open up
b.R
and highlight the code and run, it is successful:However, if I leave the same code block highlighted, restart my R session, and click run without re-highlighting the code, it fails, indicating that it is unable to load module
a
in my current project directory.However, clicking back on the
b.R
script and running line by line or re-highlighting will successfully run. With more complex modules with multiple imports, running code line by line can generate the same error, where it seems the RStudio pathing has lost track of the source file and defaults to project directory or base directory, depending if in a project environment or not.I can explore a more complex reprex if helpful. This is not a critical bug, but something other colleagues have noticed so flagging here.
R version
RStudio version
‘box’ version
‘1.2.0’