Bottom Page

Thread Rating:
  • 3 Vote(s) - 2.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 System Command
#1
my question here


def systemCommand(cmd):
terminalProcess = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
terminalOutput, stderr = terminalProcess.communicate()
What do these lines mean?
Thanks  Smile
Quote
#2
It is a definition of a function called systemCommand.
You completely missed the Python tags where you have to put your code. No indentation at all

The function doesn't return an object
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Quote
#3
def systemCommand(cmd):
terminalProcess = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
terminalOutput, stderr = terminalProcess.communicate()
Apart from definition what does it do? What's the function of this def?

def systemCommand(cmd):
terminalProcess = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
terminalOutput, stdef systemCommand(cmd):

def systemCommand(cmd):
      terminalProcess = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
      terminalOutput, stdef systemCommand(cmd):
I am new to the forum , sorry for not indenting!!
Quote
#4
It executes a shell command passed as an argument to the function.
Then gets the output but nothing else. The output is not returned and nothing else is happening except the shell command execution.

See: https://docs.python.org/3.5/library/subprocess.html
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Difference between os.system("clear") and os.system("cls") chmsrohit 6 694 Jun-16-2019, 11:38 AM
Last Post: DeaD_EyE
  run command on system with multi qoutes evilcode1 16 1,292 Aug-31-2018, 05:19 PM
Last Post: evilcode1

Forum Jump:


Users browsing this thread: 1 Guest(s)