I have a cygwin application which i have invoked using python script like:
os.system("path of the exe file")
How can i enter text in the cygwin( which has appeared )using the python script itself???
解决方案Are you running Python directly from Windows or from CygWin? In case you run Python from Windows you probably need to use COM to send text to the CygWin window. The win32com module can be used (included in the PythonWin distribution). Look at other posts here for more information.
I would suggest that you build Python on CygWin instead (or download Python built for CygWin) and then you can make any os.system call you want to instead of sending text to the CygWin window.
Best regards
/Fredrik
Can you do something like this?
Expand|Select|Wrap|Line Numbers
thanks for all ur valuable suggestions.
Whenever i use popen to invoke cygwin application or any other application(e.g a simple notepad) the application is not appearing on the screen
eg.
import os
fd = os.popen("C:\cygwin\cygwin.bat","w")
fd.write("telnet 101.29.34.132")
fd.close()
i am unable to view any changes this program makes
我有一个使用python脚本调用的cygwin应用程序,如:
os.system("exe文件的路径")
我如何输入cygwin中的文本(已经出现)使用python脚本本身???
解决方案
你是直接从Windows运行Python还是从CygWin运行?如果您从Windows运行Python,您可能需要使用COM将文本发送到CygWin窗口。可以使用win32com模块(包含在PythonWin发行版中)。在这里查看其他帖子以获取更多信息。
我建议您在CygWin上构建Python(或者下载为CygWin构建的Python)然后你可以让任何os.system调用你想要而不是发送文本到CygWin窗口。
最好的问候
/ Fredrik
你能做点什么吗?像这样?
展开 | 选择 | Wrap | 行号
感谢所有您宝贵的建议。
每当我使用popen时调用cygwin应用程序或任何其他应用程序(例如一个简单的记事本)应用程序没有出现在屏幕上
例如。
import os
>
fd = os.popen(" C:\ cygwin \cygwin.bat"," w")
fd.write(" telnet 101.29.34.132" )
fd.close()
i无法查看此程序所做的任何更改