title: How to deal with awk commas using paramiko on Django?
body: <pre><code>stdout = session.exec_command('''find {} -name "{}*" -type f -exec stat -c "%n %y" {}&lt;--**This is bash, not variable of format** + | awk "{ print $1" "$2 }" | grep -v word'''
  .format(VARIABLE1, VARIABLE2))
  </code></pre>
  
  <p>I'm doing this code using paramiko 2.4 on Django 1.9.13, don't know how to deal with it, the error is:</p>
  
  <blockquote>
    <p>KeyError at /get_xml/index/ ' print $1" "$2 '</p>
  </blockquote>
  
  <p><strong>UPDATED</strong>:</p>
  
  <p>It doesn't crash right now, but doesn't returns anything, but if I do on bash, it's working, think there's missing something...</p>
  
  <pre><code>command = find {} -name '{}*.xml' -type f -exec stat -c '%n %y' {{}} + | awk '{{print $1, $2, $3}}' | grep -v 'word'
  
  stdout = session.exec_command(command)
  </code></pre>
  
  <p><strong>ANSWER</strong></p>
  
  <pre><code>ssh.connect(hostname=VARIABLE1, username=VARIABLE2)
  command = "find {} -name '{}*.xml' -type f -exec stat -c '%n %y' {{}} + | awk '{{print $1, $2, $3}}' | grep -v WHATIDONTWANTTO".format(VARIABLE3, WHATIWANTTOSEARCH)
  _, stdout, _ = ssh.exec_command(command)
  for item in stdout:
       #do whatever with items
       pass
  </code></pre>
  
  <p>finally it works, the last way was with session = ssh.get_transport().open_session() but it always retrieve 'Nonetype'</p>