setup.py - just what is it for ?

richardshea at despammed.com richardshea at despammed.com
Sat Dec 18 06:41:26 EST 2004


OK thanks for the idea. I have tried this with rather strange restults.
First, in order to be sure I knew what was going on, I wrote a script,
SpawnvTestTarget0.py, which didn't do much apart from write to a file.

I then wrote another script which spawnv'd SpawnvTestTarget0.py from
within the CGI context.

This all worked fine. At this point I thought things were looking
pretty good.

I then added in a spawnv to the setup.py (ie the script I really wanted
to be able to run) but as soon as I tried that I got an 'Internal
Server Error' message.

I've also noticed that in the directions for installing it *does* say
that you should run setup.py as root which is probably at least
contributing to the problem. Anyway out of interest here is my script
...


#!/usr/bin/python2.2
"""
A script to try to run an install.py
on a webserver to which I do not have
shell access

Usage: /installshell.cgi
"""

import cgitb; cgitb.enable()
import sys, os, cgi, pickle
from Cookie import SimpleCookie
def print_headers(headers):
for k, v in headers.items():
sys.stdout.write('%s: %s\n' % (k, v))
sys.stdout.write('\n')

print_headers({'Content-type':'text/html'})

sys.stdout.write('<html><body>')
sys.stdout.write('About to execute SPAWNV Command - 1<BR>')
os.spawnv(os.P_WAIT,'/usr/bin/python2.2',['python','setup.py','install'])
os.spawnv(os.P_WAIT,'/usr/bin/python2.2',['python','SpawnvTestTarget0.py','install'])
sys.stdout.write('Finished in execute of SPAWNV Command')
sys.stdout.write('</body></html>')

... I've got to go to bed now but later I'm going to try just using the
script as it is - I strongly suspect the setup.py in this case is icing
rather than cake ... then again I may be demonstrating my ignorance !
thanks for your help




More information about the Python-list mailing list