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.
question from:
https://stackoverflow.com/questions/65912147/reticulate-py-run-file-function-cant-execute-python-script 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…