Use Reticulate To Call Python Script And Send Email
Solution 1:
This execution problem
This works correctly when I run it line by line from within RStudio. The problem is that it doesn't work when the script runs on schedule
can stem from multiple reasons:
You have multiple Python versions where
smtplib
is installed on one version (e.g., Python 2.7 or Python 3.6) and not the other. Check which Python is being used at command line,Rscript -e "print(Sys.which("python"))"
and RStudio,Sys.which("python")
. Explicitly define which Python.exe to run with reticulate'suse_python("/path/to/python")
.
You have multiple R versions where Rscript uses a different version than RStudio. Check
R.home()
variable in both:Rscript -e "print(R.home())"
and callR.home()
in RStudio. Explicitly call the required Rscript in appropriate R version bin folder:/path/to/R #.#/bin/Rscript "/path/to/code.R"
.
Post a Comment for "Use Reticulate To Call Python Script And Send Email"