简体   繁体   English

Python将参数传递给已经运行的可执行文件

[英]Python passing arguments to already running executables

I'm trying to pass an argument at an executable program launched from the command line. 我试图在从命令行启动的可执行程序中传递参数。 The passed argument is not required at the initial executable execution but it is asked after some computations are done. 最初的可执行文件执行时不需要传递的参数,但是在完成一些计算后会询问它。 The process remains in pending condition until the required argument is passed from command line. 在从命令行传递所需的参数之前,该过程一直处于挂起状态。 After the insertion of such parameter the program ends its execution. 插入此类参数后,程序将结束其执行。 I need to automate the overall process. 我需要使整个过程自动化。 Is there anyone who can help me ? 有谁可以帮助我吗?

Any possible suggestions are welcome 欢迎任何可能的建议

Michele 米歇尔

You need interaction, a way to start a process, and then monitor its output and be able to pass input to the process.. 您需要进行交互,这是启动流程的一种方法,然后监视其输出并将输入传递给流程。

Python has this, it is called subprocess.Popen . Python具有此功能,它称为subprocess.Popen There are many examples of similar questions and answers here on StackOverflow. StackOverflow上有许多类似问题和答案的示例。

For example: 例如:

And many more . 还有更多

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM