Hi,
Love the export capability. However, when interactively debugging a script that's used as a module, the export() call crashes and I'm forced to manually comment out the export calls during debug sessions. Could we somehow safely avoid the crash?
for example script_to_debug.R
export("foo")
foo <- function(x) {
x
}
sourcing this script in an interactive R session crashes with:
> source("xxxxx/script_to_debug.R", echo=TRUE)
> export("foo")
Error in get(exportNameWithinModule(), envir = envir) :
object '.__exports__' not found
I suppose a quick fix is something like this in modules export.R
export <- function(..., where = parent.frame()) {
if (!exists(exportNameWithinModule(), envir = where)) {
# not in a module, likely called from user sourcing a script during debug session. do nothing.
return(invisible(NULL))
}
...
}
test-export.R still runs fine. However I have no idea of the implications...
Hi,
Love the export capability. However, when interactively debugging a script that's used as a module, the export() call crashes and I'm forced to manually comment out the export calls during debug sessions. Could we somehow safely avoid the crash?
for example script_to_debug.R
sourcing this script in an interactive R session crashes with:
I suppose a quick fix is something like this in modules export.R
test-export.R still runs fine. However I have no idea of the implications...