Python script in R reticulate: Error in py_run_file_impl(file, local, convert) : SystemExit: 2

203 Views Asked by At

I have a Python script that I want to use in my R code (to calculate a certain amount of precipitation at specified location (coordinate)).

I already used this code:

setwd('C:/Users/username/Documents')
library(reticulate)
reticulate::source_python("raster_extract.py")

but this turns into the error

usage: python.exe [-h] [--coords COORDS [COORDS ...]] [--input INPUT] [--odim]
                  [--band BAND] [--output OUTPUT] [--writer WRITER]
                  [--decimals DECIMALS]
                  path [path ...]
python.exe: error: the following arguments are required: path
Error in py_run_file_impl(file, local, convert) : SystemExit: 2
Run `reticulate::py_last_error()` for details.

I looked up on the internet what this error could mean, but nothing could help me so far. I'm stuck on it for quite a long time. Is there someone who can tell me why I'm not able to integrate this Python code into my R script?

0

There are 0 best solutions below