I have made the following subprocess to interact with the yowsup-cli.
connection_string = "python /root/yowsup/yowsup-cli demos --yowsup --config config.json"
popen_parameters = connection_string.split(" ")
proc = Popen(popen_parameters, stdout=PIPE, stderr=PIPE)
out, err = proc.communicate()
The interaction works fine I am able to send parameters but I have no return from the CLI of the yowsup-cli. the return is working in the background.
I need to send some variables from the input and receive the result from yowsup-cli.
I used Pexpect and create a algorithm to reach my goal. For those who will need to create an automation here is what I used:
The trick was to create a
bashchild process before running python script.After the last line the
child.expect('offline')you can send the desired commands in a logic that will fit your porpoise.Hope this help others