I am trying to call a Python
script without using R Markdown in Reticulate in a R script. I have a requirement to call the R script by a third-party application (using SYSTEM account) which will then call the Python script. Basically I want to use R variables inside Python. While it works fine when I execute it logged in Windows it does not when executing by the SYSTEM account in Windows. I have Python
installed under C:\Program Files\Python38\python.exe
R code:
Sys.setenv(RETICULATE_PYTHON = "C:\\Program Files\\Python38\\python.exe")
library(reticulate)
use_python("C:\\Program Files\\Python38\\python.exe", required = T)
message <- paste("Text from R", format(Sys.Date(), "%c"), sep = " ")
py_run_file("test_script.py")
Python code:
import logging
logging.basicConfig(filename="test_script.log", level=logging.DEBUG,format='%(levelname)s: %(asctime)s %(message)s',datefmt='%m/%d/%Y %I:%M:%S')
logging.debug(r.message)
Output when logged on:
DEBUG: 10/30/2020 08:02:10 Text from R sex out 30 00:00:00 2020
Output when running with SYSTEM account:
DEBUG: 10/28/2020 02:28:37 <function make_python_function.<locals>.python_function at 0x00000243D21E3168>
Windows 10
R version 4.0.3
Python version 3.8.6
Reticulate version 1.18
What is this make_python_function
and how to make it work under SYSTEM account? Thanks for any info!