I’m trying to build a custom gui app on python for hotspotshield VPN, a bit like this one, but more fitted for my needs : https://github.com/kiraitachi/PyShieldGUI
I am having an issue with sending commands to the terminal. Though the commands works in the terminal, i can’t seem to make it work in python.
I am new to linux, so there may be somethings I don’t understand about it…
I have tried subprocess.run and subprocess.Popen, but both seems to have issues with sending the commands. The issue is the same when using the PyShieldGUI code.
Here’s my latest attempt, which seems the closest to running :
`command = ["hotspotshield", "account", "signin"] ## (I tried both a string and a list)
process = subprocess.Popen(command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
process.stdin.write(f"{username}/n")
process.stdin.write(f"{password}/n")
process.stdin.flush()
stdout, stderr = process.communicate()`
when trying the function, i get a “account: line 1: hotspotshield: command not found”
For what it’s worth, I did confirm that the executable for hotspotshield is in the PATH.
damdamdam is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.