2024-09-28 01:30:21 发布
网友
我正在编写的python脚本调用exe文件时遇到了这个问题(子进程.Popen). 我正在将stdout和stderr重定向到PIPE,但我无法读取(子进程.Popen.stdout.readline())任何输出。在
我试过在WindowsCLI中运行exec文件并重定向stdout和stderr。。。什么也没发生。所以我估计这个Qt应用程序中没有stdout和stderr。在
有什么方法可以让我在屏幕上打印这个exe的数据吗photivo.exe)? 在
Warning: Use communicate() rather than .stdin.write, .stdout.read or .stderr.read to avoid deadlocks due to any of the other OS pipe buffers filling up and blocking the child process.
https://docs.python.org/3/library/subprocess.html#subprocess.Popen.stderr
也就是说试试这样的东西
process = subrocess.Popen(...) stdout, stderr = process.communicate() print(stdout) print(stderr)
来自http://doc.qt.io/qt-5/debug.html:
With Windows, if it is a console application, the text is sent to console; otherwise, it is sent to the debugger.
Windows上有一个特殊的调试通道(WinAPI函数OutputDebugString)。另请参见How does Qt5 redirect qDebug() statements to the Qt Creator 2.6 console
现在有可能photivo.exe使用普通的qDebug()生成输出并写入调试通道。您可以使用the tool DebugView来验证这一点。在
在这种情况下,您必须找到从Python或fork读取调试通道的方法photivo.exe并使其使用STDOUT/STDERR而不是qDebug()。在
https://docs.python.org/3/library/subprocess.html#subprocess.Popen.stderr
也就是说试试这样的东西
来自http://doc.qt.io/qt-5/debug.html:
Windows上有一个特殊的调试通道(WinAPI函数OutputDebugString)。另请参见How does Qt5 redirect qDebug() statements to the Qt Creator 2.6 console
现在有可能photivo.exe使用普通的qDebug()生成输出并写入调试通道。您可以使用the tool DebugView来验证这一点。在
在这种情况下,您必须找到从Python或fork读取调试通道的方法photivo.exe并使其使用STDOUT/STDERR而不是qDebug()。在
相关问题 更多 >
编程相关推荐