2016-03-08 99 views
0

这可能是一个非常简单的问题,但我无法弄清楚。我编写了一个Python GUI应用程序(使用PyQT),我所要做的就是用可执行脚本启动它。我仍在调试应用程序,所以如果终端保持打开状态以查看任何错误/打印语句/抛出的异常,那就好了。从bash脚本运行Python GUI应用程序时保持终端打开

这是我在我的剧本已经有了:

#!/bin/sh 
x-terminal-emulator -e cd dirname && python GUIapp.py 

它成功运行的Python应用程序,但一旦应用程序加载时,终端会自动关闭。终端关闭后,应用程序继续运行。

我知道我可以打开一个终端,然后只需输入“cd dirname & & python GUIapp.py”,但我很懒。

我在这里错过了什么?

回答

0

使用--hold--noclose选项。它们具有不同名称的相同功能。

所以改变脚本

#!/bin/sh 
x-terminal-emulator --noclose -e cd dirname && python GUIapp.py 

如果你正在寻找一个命令选项,经常检查--help。在这种情况下,它会给你所需的信息。

[email protected]:~/projects$ x-terminal-emulator --help 
Usage: x-terminal-emulator [Qt-options] [KDE-options] [options] [args] 

Terminal emulator 

Generic options: 
    [...] 

Options: 
    [...] 
    --hold, --noclose   Do not close the initial session automatically when it ends. 
    [...] 
相关问题