reticulate py_run_file() function can't execute python script

Why am I getting this error???

I am using pyenv virtualenv in wich I have started R

> library(reticulate)
> py_discover_config()
python:         /home/zvuser/.pyenv/shims/python3
libpython:      /home/zvuser/.pyenv/versions/3.7.5/lib/libpython3.7m.so
pythonhome:     /home/zvuser/.pyenv/versions/zvpjct:/home/zvuser/.pyenv/versions/zvpjct
version:        3.7.5 (default, Jan 26 2021, 19:47:35)  [GCC 7.5.0]
numpy:          /home/zvuser/.pyenv/versions/3.7.5/envs/zvpjct/lib/python3.7/site-packages/numpy
numpy_version:  1.19.5

python versions found:
 /home/zvuser/.pyenv/shims/python3
 /usr/bin/python3
 /usr/bin/python

> py<-import_main()
> py$var1=1
> py$var2=2
> py_run_file('blah.py')
Error in py_run_file_impl(file, local, convert) :
  IndexError: list index out of range

Detailed traceback:
  File "<string>", line 3, in <module>

Here is the python script:

cat blah.py

from sys import argv

var1=argv[1]
var2=argv[2]
vzv=var1+var2
print(vzv)

What is wrong with this code. I am running of ideas. I tried use_python('/home/zvuser/.pyenv/versions/3.7.5/bin/python3.7') no difference.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.