#!/usr/bin/python
#################################################################################
# This is an imported script
#################################################################################
def exec_process():
#   import var_missing              #attempt to execute
    import x_indent                 #attempt to execute

#################################################################################
# In main code
# I wrapped the entire imported script in a try/except block
#################################################################################
try:
    exec_process()
    
except Exception as ex:
    import sys, traceback, subprocess
    print("Content-Type: text/plain \n")            #http header with newline (in case it was not done)
    print('<pre>')
    print("Processing Error - ", ex )               #print processing error
    traceback.print_exc(file=sys.stdout)            #print traceback stack on stdout instead of stderr
    print()
    
    error_log_file = "/var/log/httpd/error_log"
    output = subprocess.check_output(['tail', '-3', error_log_file])
    output = output.decode()
    print(output)
    print()
    
    access_log_file = "/var/log/httpd/access_log"
    output = subprocess.check_output(['tail', '-3', access_log_file])
    output  = output.decode()
    print(output)
    print()