Получите ошибку, когда я попробую к открытому приложению из Python

    if "open" in text:
        app = text.split(" ", 1)
        self.respond("opening " + app[1])
        os.system("open -a " + app[1]  + ".app")

получите эту ошибку

open: invalid option -- 'a'
Usage: open [OPTIONS] -- command

This utility help you to start a program on a new virtual terminal 
(VT).

Options:
-c, --console=NUM   use the given VT number;
-e, --exec          execute the command, without forking;
-f, --force         force opening a VT without checking;
-l, --login         make the command a login shell;
-u, --user          figure out the owner of the current VT;
-s, --switch        switch to the new VT;
-w, --wait          wait for command to complete;
-v, --verbose       print a message for each action;
-V, --version       print program version and exit;
-h, --help          output a brief help message.
1
задан 25 November 2018 в 16:02

2 ответа

Вы не нуждаетесь ни в какой дополнительной команде, просто называете программу непосредственно:

os.system(app[1])

Однако я использовал бы sh для этого.

0
ответ дан 7 December 2019 в 22:22

Это работает, когда я называю его непосредственно:

os.system("firefox")

Однако также важно, чтобы первая буква не была капиталом при вызове любой программы, т.е.: если Вы звоните Firefox Вы получаете ошибку, но firefox работает хорошо.

0
ответ дан 7 December 2019 в 22:22

Другие вопросы по тегам:

Похожие вопросы: