avoid user abort python subprocesses
Question: I want the process i initiate through the script to run on webserver even if
user closes the page. It doesn't seem to be working with this:

    
    
    #!/usr/bin/env python
    # -*- coding: UTF-8 -*-
    
    import cgi,cgitb,subprocess
    
    print "Content-Type: text/plain;charset=utf-8"
    print
    
    form = cgi.FieldStorage()
    ticker = form['ticker'].value
    
    print subprocess.Popen(['/usr/bin/env/python','options.py',ticker])
    

Please help! Thanks!


Answer: I guess this is wrong:

    
    
    '/usr/bin/env/python'
    

it should be usually:

    
    
    '/usr/bin/env python'
    

but better use this:

    
    
    >>> import sys
    >>> sys.executable # contains the executable running this python process
    'C:\\Python27\\pythonw.exe'
    

I use to do it like this:

    
    
    p = subprocess.Popen([sys.executable,'options.py',ticker])
    

