2016-03-08 112 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. 
    [...] 
相關問題