I am programming a Ros interface in python, and I would like to be able to select the node I want to run from a list showing all available nodes once I choose a package.
In other words I would like to create the list of all nodes contained in a package getting the output I would have in the terminal if I type:
rosrun <package-name> \t\t
In terms of python code, a wrong example of what I am trying to do could be:
from subprocess import Popen, PIPE
p = Popen (["rosrun", "<package-name>", "\t\t"], stdout = PIPE, stderr = PIPE)
out, err = p.communicate ()
print (out.decode ("ascii"))
print (err.decode ("ascii"))
But this does not work because "\t\t" is not processed in Popen like it is in the terminal.
Is there any way to get this working or is it impossible to emulate the double-tab completion of the terminal from inside a python script?
Is Popen to be used in a different way to do this or should I totally change the code using other facilities?
Please help me :)