strange cgi print problem

Jeroen Wolff jwolff at ision.nl
Thu May 31 21:41:30 EDT 2001


I've got a strange cgi print problem.
When i run this script as user "nobody"
on the console is works fine and generate
nice output. 
When i launch it from my webbrowser, i shows
only the output of HTMLHead() when i view the source.
The print RIPEWhois("AS12394") output is only a space...

Please can somebody help...

Thx,

Jeroen



#!/usr/local/bin/python

import string, os


def HTMLHead():
    print "Content-type: text/html"
    print
    print "<HTML><HEAD><TITLE></TITLE></HEAD>"
    print "<BODY>"


def RIPEWhois( ASnr ):
    descr = ""
    goedeAS = 0
    fp = os.popen("ripewhois "+ASnr+" -r")
    for regel in fp.readlines():
        columns = regel[:-1].split(":")
        if len(columns) > 1:
            if columns[0].strip() == "aut-num" \
                and columns[1].strip() == ASnr:
                goedeAS = 1
            if columns[0].strip() == "descr" and goedeAS:
                descr = columns[1].strip()
                break
    fp.close()
    return descr


HTMLHead()
print RIPEWhois("AS12394")

print "</CENTER></BODY></HTML>"



More information about the Python-list mailing list