runDemoApp() throws an error when locale is not set to "en-US"
Closed this issue · 8 comments
I got an error when trying to run runDemoApp(). As my system language is Spanish, the error message was not in English so in order to submit this issue I switched to "en-US" by setting Sys.setenv(lang = "en_US") in my .Rprofile, restarted Rstudio and, surprisingly, this time the app ran without error.
In English it would read as 'Argument "container" is missing, with no default':
Running Sys.getlocale() returns:
"LC_COLLATE=Spanish_Spain.utf8;LC_CTYPE=Spanish_Spain.utf8;LC_MONETARY=Spanish_Spain.utf8;LC_NUMERIC=C;LC_TIME=Spanish_Spain.utf8"
Hi, thank you for reporting.
Unfortunately I wasn't able to reproduce the error so far.
Some ideas that might help pinpoint the problem:
Could you also include the sessionInfo()
?
Is it only happening when running runDemoApp("mtcars")
?
Could you check if the same error occurs when running one of the following?
editbl::eDT(mtcars)
editbl::runDemoApp()
Could you also try to run the code straight from the command line instead of RStudio?
With a fresh R installation I tried reproducing your bug.
Unfortunately, without success.
Here are the details:
library(editbl)
library(devtools)
Sys.setlocale("LC_ALL", "Spanish_Spain.utf8")
[1] "LC_COLLATE=Spanish_Spain.utf8;LC_CTYPE=Spanish_Spain.utf8;LC_MONETARY=Spanish_Spain.utf8;LC_NUMERIC=C;LC_TIME=Spanish_Spain.utf8"
R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=Spanish_Spain.utf8 LC_CTYPE=Spanish_Spain.utf8
[3] LC_MONETARY=Spanish_Spain.utf8 LC_NUMERIC=C
[5] LC_TIME=Spanish_Spain.utf8
time zone: Europe/Berlin
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_2.4.5 usethis_2.2.2 editbl_1.0.3 shiny_1.8.0
loaded via a namespace (and not attached):
[1] miniUI_0.1.1.1 jsonlite_1.8.8 dplyr_1.1.4 compiler_4.3.2
[5] promises_1.2.1 tidyselect_1.2.0 Rcpp_1.0.12 stringr_1.5.1
[9] later_1.3.2 jquerylib_0.1.4 uuid_1.1-1 yaml_2.3.8
[13] fastmap_1.1.1 mime_0.12 R6_2.5.1 shinyjs_2.1.0
[17] generics_0.1.3 htmlwidgets_1.6.4 tibble_3.2.1 profvis_0.3.8
[21] bslib_0.6.1 pillar_1.9.0 rlang_1.1.3 utf8_1.2.4
[25] DT_0.31 stringi_1.8.3 cachem_1.0.8 httpuv_1.6.13
[29] fs_1.6.3 sass_0.4.8 pkgload_1.3.3 memoise_2.0.1
[33] cli_3.6.2 withr_2.5.2 magrittr_2.0.3 crosstalk_1.2.1
[37] digest_0.6.34 fontawesome_0.5.2 xtable_1.8-4 remotes_2.4.2.1
[41] lifecycle_1.0.4 vctrs_0.6.5 glue_1.7.0 urlchecker_1.0.1
[45] sessioninfo_1.2.2 pkgbuild_1.4.3 fansi_1.0.6 purrr_1.0.2
[49] tools_4.3.2 pkgconfig_2.0.3 ellipsis_0.3.2 htmltools_0.5.7
> editbl::eDT(mtcars)
So I'm not sure what the issue might be.
Some more suggestions:
You can try running:
DT::datatable(mtcars)
. If this gives any error, the issue should likely be moved to https://github.com/rstudio/DT.
Otherwise I would suggest debugging yourself a bit further.
> debugonce(editbl::eDT)
> eDT(mtcars)
debugging in: eDT(mtcars)
debug: {
args <- as.list(environment())
if (is.null(shiny::getDefaultReactiveDomain())) {
if (missing(id)) {
args$id <- "nevergonnaletyoudown"
}
if (missing(container)) {
args$container <- NULL
}
result <- do.call(eDT_app, args)
}
else {
if (missing(id)) {
stop("Please specify an id")
}
result <- do.call(eDTServer, args)
}
result
}
If you can run through that code manually and indicate at which line things go wrong, I might be able to help further.
E.g. what's the value of container
? Does it get to the code where args$container <- NULL
?
DT::datatable(mtcars)
doesn't give an error. I've used that package many times without problems too.
I'm running the debugging on eDT and as soon as I enter the debugging mode, container
shows up as Missing argument
in the environment pane of RStudio (whether I start the session with en-US system locale or Spanish).
The line args$container <- NULL
does run.
The execution stops with an error when the line result <- do.call(eDT_app, args)
is run, but only when running with Spanish locale. When I run with "en-US", it doesn't fail.
I tried to keep stepping into function calls and I reached runApp()
. I got to the following while
loop, where one of the iterations throwed the error:
..stacktraceoff..(captureStackTraces({
while (!.globals$stopped) {
..stacktracefloor..(serviceApp())
}
}))
In particular, this one:
Warning: Error in module: el argumento "container" está ausente, sin valor por omisión
60: shiny::is.reactive
59: module
54: callModule
53: moduleServer
52: <Anonymous>
50: module
45: callModule
44: moduleServer
43: <Anonymous>
41: server
4: shiny::runApp
3: <Anonymous>
1: eDT
Error in module(childScope$input, childScope$output, childScope, ...) :
el argumento "container" está ausente, sin valor por omisión
Translated, the sentence el argumento "container" está ausente, sin valor por omisión
is that same Argument "container" is missing, with no default
.
Anyways, if you think trying to find the root cause of this bug is not worth it don't worry about it. I can easily circumvent it by setting the locale to "en-US" (which is something that I'm going to do by default, as English is the language everyone uses in the R scene). I'll help however I can if you decide to keep going though. After all, I'm not quite experienced with reporting bugs or debugging so this is a learning opportunity for me.
I have the same problem with the container argument
> editbl::eDT(tibble::as_tibble(mtcars))
Listening on http://127.0.0.1:7524
Warning: Error in module: el argumento "container" está ausente, sin valor por omisión
60: shiny::is.reactive
59: module
54: callModule
53: moduleServer
52: <Anonymous>
50: module
45: callModule
44: moduleServer
43: <Anonymous>
41: server
4: shiny::runApp
3: <Anonymous>
1: editbl::eDT
Error in module(childScope$input, childScope$output, childScope, ...) :
el argumento "container" está ausente, sin valor por omisión
I see that in the editbl::eDT()
function, the container argument is not defined.
Line 133 in 6929fd9
Further on, in case it is not defined it only receives NULL
Lines 165 to 167 in 6929fd9
Although the documentation inherited from datatable indicates that it should be defined with htmltools::tags$table()
https://github.com/rstudio/DT/blob/06d3ae65b5e9b1b0c494de8cacaccfc60c7018cc/R/datatables.R#L27-L29
Inside the function in datatable if they define the argument container in case it is as missing
https://github.com/rstudio/DT/blob/06d3ae65b5e9b1b0c494de8cacaccfc60c7018cc/R/datatables.R#L329-L333
When I execute the function by defining the argument, there is no error.
> editbl::eDT(tibble::as_tibble(mtcars), container = htmltools::tags$table())
Thanks for the detailed search and easy workaround.
Also thanks for bringing this to my attention again.
This issue got a bit low on my priority list since I couldn't reproduce it and there was a workable alternative.
After taking a fresh look though, I'm pretty confident I found the culprit.
Can you install the branch and confirm it it works?
remotes::install_github("https://github.com/openanalytics/editbl", ref = "fix_missing_container", subdir = "editbl")
Nice, thank you for testing!