![](/img/trans.png)
[英]Code with open cv in python in macos: process is launched in terminal but nothing happens
[英]Communicating to a process launched in the Terminal in UNIX through python
我正在创建一个GUI,以简化UNIX中的某些任务。 我想在UNIX中通过Terminal启动一个进程。 我用了
subprocess.Popen()
启动该过程。 问题是,当我启动该过程时,该过程会要求用户输入其密码。 我正在考虑创建一个窗口,要求用户输入密码。 如何将在窗口中键入的密码发送到终端中启动的进程?
这是代码:
password = wx.TextEntryDialog(None, "What is your password?", 'Password')
if password.ShowModal() == wx.ID_OK:
response = password.GetValue()
command = 'ssh -X pcalcul0 firefox http://qualnetsrv/intraqual//identification.aspx?ref=G0-1427'
user_manual = subprocess.Popen(command, universal_newlines=True,
stdin=response,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=True)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.