> i m making a app in which i launch application using os.system("input from
> user"). I want to check whether the input entered by the user matches with
> the exact keyword in terminal or not.
> like i want to launch vlc so user should provide me input as " vlc" in order
> to launch the app just like he did from terminal. I want to make a check on
> the input spell so that if he type "wlc" it shows an error to it. I have an
> little idea abt sys.agrv but don't know how to use it... Plz help me guys.
Check the return value from os.system. If it's not 0, there was an error,
likely caused by incorrect input.
Better yet, catch the error message you get back from the command line, and act
on that (eg, show it to the user).
Eg,
>>> r = os.system("hello")
sh: hello: command not found
>>> print r
32512
And have a look at the subprocess module, which I think is now the de facto
module to run external processes.
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor