"Error in s$close() : attempt to apply non-function" when calling `gtsave()`
Asked Answered
I

1

10

I use the gt package to create and save a table that I produce. Recently, I have sometimes been getting the following error when I attempt to gtsave.

Error in s$close() : attempt to apply non-function

Here is session information:

> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.9          later_1.3.0         cellranger_1.1.0    pillar_1.8.1        compiler_4.1.1      tools_4.1.1        
 [7] digest_0.6.29       jsonlite_1.8.0      googledrive_2.0.0   lifecycle_1.0.2     gargle_1.2.1        tibble_3.1.8       
[13] gtable_0.3.1        pkgconfig_2.0.3     rlang_1.0.5         svGUI_1.0.1         cli_3.4.0           rstudioapi_0.14    
[19] commonmark_1.8.0    curl_4.3.2          fastmap_1.1.0       webshot2_0.1.0      dplyr_1.0.10        stringr_1.4.1      
[25] generics_0.1.3      fs_1.5.2            vctrs_0.4.1         sass_0.4.2          svDialogs_1.1.0     websocket_1.4.1    
[31] googlesheets4_1.0.1 grid_4.1.1          tidyselect_1.1.2    chromote_0.1.1      glue_1.6.2          R6_2.5.1           
[37] processx_3.7.0      fansi_1.0.3         tidyr_1.2.1         purrr_0.3.4         ggplot2_3.3.6       magrittr_2.0.3     
[43] ps_1.7.1            promises_1.2.0.1    scales_1.2.1        htmltools_0.5.3     ellipsis_0.3.2      gt_0.7.0           
[49] colorspace_2.0-3    utf8_1.2.2          stringi_1.7.8       munsell_0.5.0

I can install.packages("webshot") again to and then re-run my code usually without issue. However, this isn't a great solution. Anyone have any suggestions? I have managed to recreate this issue on two different, independent computers (and code) after updating my R, Rstudio, and all of my packages.

Thanks!

Insociable answered 5/10, 2022 at 17:44 Comment(6)
I also encountered this today. I wasn't having issues before upgrading my R version from 4.1.2. I wonder if that has something to do with it.Acceptation
I think so. based on only getting this error on machines that I have upgraded. What I have noticed is that if I restart R, rather than just resuming work from yesterday, I don't encounter this problem. I think that's why the "re-installation" helps - because it was forcing my R to restart. Hope that helps AND that they find a real solution!Insociable
I would file this as a bug on GitHub for webshot, since I've seen reports of this bug separate from gt.Acceptation
Hi guys I also encounter this problem too has it been reported as a big, please any solution yetDover
just had same issue. Restart worked for meDredi
Having the same issue repeatedly hitting on gtsave call. Happens randomly and R session/studio restart works.Headstrong
T
8

I've encountered this typically when I return to an R session after my computer went into standby. I found this workaround to run gtsave without having to restart the R session:

f <- chromote::default_chromote_object() #get the f object
f$close()

Note that it outputs an error (Error in self$send_command(msg, callback = callback_, error = error_, : Chromote object is closed.), but it appears to be ignorable. I can now run gtsave as usual in the current R session.

Tildi answered 30/5, 2023 at 5:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.