"Syntax error: Unterminated quoted string" error when calling a bash script from Python
<p>I have a situation where, I need to call a bash script inside a python script which is in turn called inside another python script.</p>

<p>download-output-files.py:</p>

<pre><code>#!/usr/bin/env python
import os
import sys

for i in node_path:
    cmd="python watcher.py "+i
    os.system(cmd) ##calling another python script
</code></pre>

<p>watcher.py:</p>

<pre><code>#!/usr/bin/env python
import os
import time

        if 'finish' in child:
            print "finish found"
        cmd="./copy_output_file.sh "+node   
        os.system(cmd) ##Calling shell script here
</code></pre>

<p>copy_output_file.sh:</p>

<pre><code>#!/bin/bash

filepath=$1
cp ff /home/likewise-open/TALENTICA-ALL/mayankp/kazoo/$filepath
</code></pre>

<p>When I run <strong>download-output-files.py</strong> , it calls <strong>watcher.py</strong> , which in turn calls <strong>copy_output_file.sh</strong> and below is the error I face:</p>

<pre><code>mayankp@mayankp:~/kazoo$ python download-output-files.py 

finish found
sh: 1: Syntax error: Unterminated quoted string
</code></pre>

<p>When I run the same commands in Python shell, it runs bash script successfully. What am I missing?</p>