I'm using R 3.6.0 with RStudio 1.2 in a Windows 10 machine. All packages are up to date. If I try to run the following commands from RStudio terminal they run ok:

py_run_string("import os")

But if I try to run the py_run_string("import os") command either in an isolated R session (calling R itself instead of RStudio) or through .Rprofile when initializing a project, I get the following error:

"Error in mapply(function(from, to) paste(lines[from:to], collapse = "\n"), : zero-length inputs cannot be mixed with those of non-zero length"

The library command is running ok. The problem happens when I try to issue the py_run_string command.

This is awkward because the command runs ok in RStudio once the session has already been started. On the other hand it doesn't run by calling R itself or through .Rprofile in RStudio.

It seems to me that RStudio is doing some kind of initialization, but I can't figure out which one is it.

Thanks for your help.

0 Answers