我已经创建了一个在Linux终端中运行命令的GUI。
EXAMPLE=> -n 20 -id 15 -domain square(10,20) -dim 2 -o execution -format geo
此命令用于执行包的代码。当它执行时,一系列的输出将在Linux终端中进行。输出要么成功,要么生成输出,要么由于转储错误或错误参数而发生错误。
终端输出实例:
错误: matheval未能处理表达式。表达式语法可能不正确。这也可能是由错误的matheval安装引起的(表达式=1 -ori光纤(,,))。中止(核心倾弃)
另一个错误
错误:糟糕的争论!中止(核心倾弃)
我要做的是将此错误作为MessageBox返回到GUI中,并/或使用该错误更新GUI的底部状态栏。
我不熟悉wx和子流程模块,但到目前为止我的研究还没有找到解决方案。
我正在运行Python2.7并使用Tkinter。
发布于 2016-03-08 17:17:44
这似乎能把工作做完。
# Create a string and pass variables
neper_exec = "neper -T -n %s -id %s -format %s -o %s -dim %s -domain %s " % (n, id, output_form, o, dim, domain)
# Execute the subporcess using the variable
p = subprocess.Popen(neper_exec, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # when shell is dropped Linux gives and error感谢@BrianMcFarland提供关于子进程命令的指导。
https://stackoverflow.com/questions/35851571
复制相似问题