commands.getstatusoutput fails saying sh: Syntax error: ";" unexpected
<p>I am running mongoimport command using python commands module as  </p>

<pre><code>status = utilities.execute(mongoimport)
</code></pre>

<p>in <strong>utilities.py</strong>  </p>

<pre><code>def execute(command):
    if not command:
        return (-1, 'command can not be empty or null')
    return commands.getstatusoutput(command)  
</code></pre>

<p>When I run this, I see error as  </p>

<pre><code>sh: Syntax error: ";" unexpected 
</code></pre>

<p>I see that <a href="http://docs.python.org/library/commands.html" rel="nofollow">documentation</a> says :  </p>

<pre><code>commands.getstatusoutput(cmd)
Execute the string cmd in a shell with os.popen() and return a 2-tuple (status, output). cmd is actually run as { cmd ; } 2&gt;&amp;1, so that the returned output will contain output or error messages  
</code></pre>

<p>How can I fix this to be able to run this command?  </p>
