3

reticulate (v1.13) returns error for each line while using R (3.5)

However when same code(and same module) is run using R-Studio it works without errors. What could be the potential settings/configs to check/compare ?

Need to have script run few times per day automatically. I did develop a working solution using R-studio. Then tried to run same script from command line R.exe..... -> errors produced. (OS WIN Server 2016 std)

NON-WORKING - using RGui (64-bit)

> library(reticulate)
Warning message:
package ‘reticulate’ was built under R version 3.5.3 
> py_run_string("import zlib, sys, struct, numpy")
Error in sys$stdout$flush() : attempt to apply non-function
> py_run_string("i = 5")
Error in sys$stdout$flush() : attempt to apply non-function
> py$i
[1] 5

Same machine - WORKING using R-Studio

> library(reticulate)
Warning messages:
package ‘reticulate’ was built under R version 3.5.3 
> py_run_string("import zlib, sys, struct, numpy")
> py_run_string("i = 5")
> py$i
[1] 5

Did try to find differencies using

py_discover_config() no luck they are the same.
(python) sys.getdefaultencoding no luck they are the same.
(R) Sys.getlocale() no luck they are the same.

Even code seems to execute - How to get rid of these: "Error in sys$stdout$flush() : attempt to apply non-function"

Community
  • 1
  • 1
  • A possible solution is to install the following version of reticulate: `devtools::install_github("erikli/reticulate")`, as described at this link http://github.com/rstudio/reticulate/issues/584 – Marco Sandri Sep 01 '19 at 08:49
  • I have the opposite problem: OP's code works in R but not in RStudio with the same error thrown. – Evgenii Dec 03 '19 at 08:36

0 Answers0