Get an error when i try to open application from Python











up vote
1
down vote

favorite












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


get this error



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.









share|improve this question







New contributor




Ahmed Aftab is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    The open command doesn't have an option -a so you can't use it. What do you expect it to do?
    – Florian Diesch
    Nov 25 at 13:18










  • i just want to open a program which one i speak for example if i said open firefox then firefox opened
    – Ahmed Aftab
    Nov 25 at 13:31












  • What’s the difference to calling it directly with e.g. os.system("firefox")?
    – dessert
    Nov 25 at 13:44










  • wow its working
    – Ahmed Aftab
    Nov 25 at 13:52












  • thanks @dessert for helping
    – Ahmed Aftab
    Nov 25 at 13:58















up vote
1
down vote

favorite












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


get this error



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.









share|improve this question







New contributor




Ahmed Aftab is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    The open command doesn't have an option -a so you can't use it. What do you expect it to do?
    – Florian Diesch
    Nov 25 at 13:18










  • i just want to open a program which one i speak for example if i said open firefox then firefox opened
    – Ahmed Aftab
    Nov 25 at 13:31












  • What’s the difference to calling it directly with e.g. os.system("firefox")?
    – dessert
    Nov 25 at 13:44










  • wow its working
    – Ahmed Aftab
    Nov 25 at 13:52












  • thanks @dessert for helping
    – Ahmed Aftab
    Nov 25 at 13:58













up vote
1
down vote

favorite









up vote
1
down vote

favorite











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


get this error



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.









share|improve this question







New contributor




Ahmed Aftab is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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


get this error



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.






python python-2.7






share|improve this question







New contributor




Ahmed Aftab is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Ahmed Aftab is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Ahmed Aftab is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 25 at 13:02









Ahmed Aftab

61




61




New contributor




Ahmed Aftab is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Ahmed Aftab is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Ahmed Aftab is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1




    The open command doesn't have an option -a so you can't use it. What do you expect it to do?
    – Florian Diesch
    Nov 25 at 13:18










  • i just want to open a program which one i speak for example if i said open firefox then firefox opened
    – Ahmed Aftab
    Nov 25 at 13:31












  • What’s the difference to calling it directly with e.g. os.system("firefox")?
    – dessert
    Nov 25 at 13:44










  • wow its working
    – Ahmed Aftab
    Nov 25 at 13:52












  • thanks @dessert for helping
    – Ahmed Aftab
    Nov 25 at 13:58














  • 1




    The open command doesn't have an option -a so you can't use it. What do you expect it to do?
    – Florian Diesch
    Nov 25 at 13:18










  • i just want to open a program which one i speak for example if i said open firefox then firefox opened
    – Ahmed Aftab
    Nov 25 at 13:31












  • What’s the difference to calling it directly with e.g. os.system("firefox")?
    – dessert
    Nov 25 at 13:44










  • wow its working
    – Ahmed Aftab
    Nov 25 at 13:52












  • thanks @dessert for helping
    – Ahmed Aftab
    Nov 25 at 13:58








1




1




The open command doesn't have an option -a so you can't use it. What do you expect it to do?
– Florian Diesch
Nov 25 at 13:18




The open command doesn't have an option -a so you can't use it. What do you expect it to do?
– Florian Diesch
Nov 25 at 13:18












i just want to open a program which one i speak for example if i said open firefox then firefox opened
– Ahmed Aftab
Nov 25 at 13:31






i just want to open a program which one i speak for example if i said open firefox then firefox opened
– Ahmed Aftab
Nov 25 at 13:31














What’s the difference to calling it directly with e.g. os.system("firefox")?
– dessert
Nov 25 at 13:44




What’s the difference to calling it directly with e.g. os.system("firefox")?
– dessert
Nov 25 at 13:44












wow its working
– Ahmed Aftab
Nov 25 at 13:52






wow its working
– Ahmed Aftab
Nov 25 at 13:52














thanks @dessert for helping
– Ahmed Aftab
Nov 25 at 13:58




thanks @dessert for helping
– Ahmed Aftab
Nov 25 at 13:58










1 Answer
1






active

oldest

votes

















up vote
0
down vote













You don’t need any additional command, just call the program directly:



os.system(app[1])


However, I’d rather use sh for that.






share|improve this answer























  • See comment on question.
    – Jacob Vlijm
    Nov 25 at 14:26










  • @JacobVlijm What do you recommend, sh?
    – dessert
    Nov 25 at 14:36






  • 1




    subprocess, either .call or .Popen, depending on the situation.
    – Jacob Vlijm
    Nov 25 at 14:40













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Ahmed Aftab is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1095901%2fget-an-error-when-i-try-to-open-application-from-python%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













You don’t need any additional command, just call the program directly:



os.system(app[1])


However, I’d rather use sh for that.






share|improve this answer























  • See comment on question.
    – Jacob Vlijm
    Nov 25 at 14:26










  • @JacobVlijm What do you recommend, sh?
    – dessert
    Nov 25 at 14:36






  • 1




    subprocess, either .call or .Popen, depending on the situation.
    – Jacob Vlijm
    Nov 25 at 14:40

















up vote
0
down vote













You don’t need any additional command, just call the program directly:



os.system(app[1])


However, I’d rather use sh for that.






share|improve this answer























  • See comment on question.
    – Jacob Vlijm
    Nov 25 at 14:26










  • @JacobVlijm What do you recommend, sh?
    – dessert
    Nov 25 at 14:36






  • 1




    subprocess, either .call or .Popen, depending on the situation.
    – Jacob Vlijm
    Nov 25 at 14:40















up vote
0
down vote










up vote
0
down vote









You don’t need any additional command, just call the program directly:



os.system(app[1])


However, I’d rather use sh for that.






share|improve this answer














You don’t need any additional command, just call the program directly:



os.system(app[1])


However, I’d rather use sh for that.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 25 at 14:41

























answered Nov 25 at 14:08









dessert

21.3k55896




21.3k55896












  • See comment on question.
    – Jacob Vlijm
    Nov 25 at 14:26










  • @JacobVlijm What do you recommend, sh?
    – dessert
    Nov 25 at 14:36






  • 1




    subprocess, either .call or .Popen, depending on the situation.
    – Jacob Vlijm
    Nov 25 at 14:40




















  • See comment on question.
    – Jacob Vlijm
    Nov 25 at 14:26










  • @JacobVlijm What do you recommend, sh?
    – dessert
    Nov 25 at 14:36






  • 1




    subprocess, either .call or .Popen, depending on the situation.
    – Jacob Vlijm
    Nov 25 at 14:40


















See comment on question.
– Jacob Vlijm
Nov 25 at 14:26




See comment on question.
– Jacob Vlijm
Nov 25 at 14:26












@JacobVlijm What do you recommend, sh?
– dessert
Nov 25 at 14:36




@JacobVlijm What do you recommend, sh?
– dessert
Nov 25 at 14:36




1




1




subprocess, either .call or .Popen, depending on the situation.
– Jacob Vlijm
Nov 25 at 14:40






subprocess, either .call or .Popen, depending on the situation.
– Jacob Vlijm
Nov 25 at 14:40












Ahmed Aftab is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Ahmed Aftab is a new contributor. Be nice, and check out our Code of Conduct.













Ahmed Aftab is a new contributor. Be nice, and check out our Code of Conduct.












Ahmed Aftab is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1095901%2fget-an-error-when-i-try-to-open-application-from-python%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Category:香港粉麵

List *all* the tuples!

Channel [V]