I have a script called DataRetrieval.py. This script connects to an internal database, retrieves data and writes that data to an Excel file. This script imports the following:
a) a utils.py helper module that contains several functions
b) a DataRetrieval.cfg configuration file (which contains all of the login information and SQL queries that the DataRetrieval.py script needs)
The DataRetrieval.py script takes the following 3 command line arguments:
DataRetrieval.py DataRetrieval.cfg 03/01/20
(the script itself, the configuration file, and a start date)
I would like to use the Reticulate package in R to:
- call each of these 3 command line arguments
- set the output of the script (which is an Excel file) to an object (the end goal is to call this object in a Shiny dashboard)
I was thinking about using the source_python() function, but I don't think it allows for multiple positional arguments. The error message returns:
> source_python("DataRetrieval.py")
Error in py_run_file_impl(file, local, convert) : SystemExit: 2
usage: python.exe [-h] [-e ENDDATE] config startDate
python.exe: error: the following arguments are required: config, startDate
What is the best way to use the Reticulate package to call these 3 command line arguments? Perhaps a single .py file that encapsulates each of the 3 arguments above?
Thanks!
reticulateand not a command line call withsystem()especially if you do not need any Python objects in R environment?