Hello, there.I am using Python 2.5. I used py_compile and made a .pyc file. However, it runs but never stops. What is the best way tocompile a .py file.I am trying to customise the attached script to do the following:calling an external Python script and passing parameters into it.And run the external Python script in this attached script.Your advice will be deeply appreciated.Regards.David
#!/usr/bin/python import cgi, os, sys, string def gush(data): print "Content-type: text/html\n" print "<h3>Thanks, %(name)s!</h3>" % vars(data) print "Our customer's comments are always appreciated." print "They drive our business directions, as well as" print "help us with our karma." print "<p>Thanks again for the feedback!<p>" print "And feel free to enter more comments if you wish." print "<p>"+10*" "+"--Joe." def whimper(data): print "Content-type: text/html\n" print "<h3>Sorry, %(name)s!</h3>" % vars(data) print "We're very sorry to read that you had a complaint" print "regarding our product__We'll read your comments" print "carefully and will be in touch with you." print "<p>Nevertheless, thanks for the feedback.<p>" print "<p>"+10*" "+"--Joe." def bail(): print "Content-type: text/html\n" print "<H3>Error filling out form</H3>" print "Please fill in all the fields in the form.<P>" print '<a href="http://localhost/comment.html">' print 'Go back to the form</a>' sys.exit() class FormData: """ A repository for information gleaned from a CGI form """ def __init__(self, form): for fieldname in self.fieldnames: if not form.has_key(fieldname) or form[fieldname].value == "": bail() else: setattr(self, fieldname, form[fieldname].value) class FeedbackData(FormData): """ A FormData generated by the comment.html form. """ fieldnames = ('name', 'address', 'email', 'type', 'text') def __repr__(self): return "%(type)s from %(name)s on %(time)s" % vars(self) DIRECTORY = '/home/brooks/public_html/cgi-bin/feedbackDir' if __name__ == '__main__': sys.stderr = sys.stdout form = cgi.FieldStorage() data = FeedbackData(form) if data.type == 'comment': gush(data) else: whimper(data)
-- http://mail.python.org/mailman/listinfo/python-list