os.system with cgi

G gggg.iiiii at gmail.com
Mon Mar 3 18:56:22 EST 2008


Hi,

   I have the following peace of code

def getBook(textid, path):
    url = geturl(textid)
    if os.path.isfile(path + textid):
        f = open(path + textid)
    else:
        os.system('wget -c ' + url + ' -O ' path + textid)
        f = open(path + textid)
    return f

The reason I am not using urllib is that I want to have random access within
the downloaded file.

When i execute the file from a regular python script I get the file
downloaded and a handle for the file returned.
When I execute the file from a python cgi script i get an error saying that
the file doesn't exist. In other words the call to os.system is not running.
Could someone please point out what the problem with that peace of code
running as a cgi script.

Best.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080303/212d3409/attachment.html>


More information about the Python-list mailing list