Is there a trick to executing this command line

cmd_line = 'python /home/amr/bin/addReadSnap.py -s ' + str(cycle)

using this function from django?

import sys
import os
import string

from subprocess import call, Popen

def exec_external_cmd(cmd_line):
    retcode = None
    try:
        process = Popen(cmd_line, bufsize=2048, executable="/bin/
bash", shell=True, stdout=None, stderr=None)

        while retcode == None:
            retcode = process.poll()

        if retcode < 0:
            print >>sys.stderr, "Child was terminated by signal", -
retcode
        elif retcode > 0:
            print >>sys.stderr, "Child returned", retcode

    except OSError, e:
        print >>sys.stderr, "Execution failed:", e

    return retcode

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to