I am having trouble using os.execv()
in Python.
I have a file called test-exec.py
that should call another file called helloworld.py
(this file should just print hello world). I want the test-exec.py
to run helloworld.py
test-exec.py
looks like the below:
import sys
import os
if __name__ == '__main__':
os.execv("usr/bin/python3", ['helloworld.py'])
when running the terminal with the command python3 test-exec.py helloworld.py
(the helloworld.py
is unnecessary right now) I get this error:
FileNotFoundError:[Errno 2] No such file or directory
but the file helloworld.py
is in the directory:
here
I'm using a virtual machine if that helps any.