title: Command to run: ls -l . '{' is not recognized as an internal or external command, operable program or batch file
body: <p>I have such code in file hello.py:</p>
  
  <pre><code>import sys
  import os
  import commands
  
  def listdir(dir):
    cmd = 'ls -l ' + dir
    print ("Command to run:", cmd)   ## good to debug cmd before actually running it
    (status, output) = commands.getstatusoutput(cmd)
    if status:    ## Error case, print the command's output to stderr and exit
      sys.stderr.write(output)
      sys.exit(1)
    print (output)  ## Otherwise do something with the command's output
  
  
  def main():
  
   listdir(sys.argv[1])
  
  if __name__ == '__main__':
    main()
  </code></pre>
  
  <p>I run it from cmd like:</p>
  
  <pre><code>$ hello.py .
  </code></pre>
  
  <p>But got error:</p>
  
  <pre><code>Command to run: ls -l .
  '{' is not recognized as an internal or external command,
  operable program or batch file.
  </code></pre>
  
  <p>Could someone help me to refine what is the problem with my code (I got it from google tutorials). python version is 2.7   </p>