Reputation: 11
I am building on package using python script on yocto Pyro.
In Python script i am using subprocess.Popen
.
As per my understanding when the Python Script runs for Cross Platform then it should take Cross-platfrom Python subprocess path however in my case its take native path "/usr/lib/python2.7/subprocess.py" i.e of PC.
Because of that i am facing in _execute_child raise child_exception
.
Can any help to resolve this issue ?
Error is below
File "/usr/lib/python2.7/subprocess.py", line 566, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
PS: i have already tried "shell=True" option but it did not resolve my issue.
Upvotes: 1
Views: 791
Reputation: 4063
If you're running a script at build time then it will run the host python as it can't run the target python binary for the obvious reason that its a target binary.
The exception your showing is simply that you're trying to run a binary that popen can't find. Remember that inside a build $PATH is sanitised so won't contain what it has outside of bitbake.
Upvotes: 2
Reputation: 2513
You should set an environment variable which points to the desired python setup and pass it to the subprocess call. Something like this
export venv='/path/to/python'
venv = os.environ["VENV_PYTHON"]
p = subprocess.Popen([venv, command], env=os.environ.copy())
This will launch your python script with the desired python setup
Upvotes: 0