if (text != '' or width != '' or char != '') and (text == '' or width == '' or char == ''): input_error = input_error + 'Please enter all fields of input before submitting.' elif text != '' and width != '' and char != '': try: complex(width) except: return f = open('./tmp-gen', 'w') f.write(text) f.close() #out = commands.getoutput('/home/tim/header.py --file ./tmp-gen --char %s --width %s' % (char, width)) out = Popen(['/home/tim/header.py', '--file=./tmp-gen', '--char=' + char, '--width=' + width], stdout=PIPE).stdout.read() print 'Content-Type: text/plain; charset=UTF-8\n\n%s' % out sys.exit() print """Content-Type: text/html; charset=UTF-8\n (etc.)