def test_basic_file_settings_no_redirect(self): #print program obj = EzhilFileExecuter(file_input=[program], debug=False, redirectop=False, TIMEOUT=10) # 2 minutes # actually run the process obj.run() # get executed output in 'progout' and name of the two tmp files to cleanup [tmpfile, filename, progout] = obj.get_output() #os.unlink( tmpfile ) #os.unlink( filename ) if obj.exitcode != 0 and EzhilWeb.error_qualifiers(progout): failed = True else: failed = False if (debug): print(u"output = ") print(u"%s,%s" % (progout.decode('utf-8'), str(failed))) return
def evaluate( request ): progin = '' evaluated = False failed = False progout = '' exception = '' if request.method == "POST": vars = {} vars['eval'] = request.POST['eval'] vars['prog'] = request.POST['prog'] progin = vars['prog'] try: evaluated = True # 10s timeout and executor obj = EzhilFileExecuter( file_input = [vars['prog']], redirectop = True, TIMEOUT = 10 ) # actually run the process obj.run() # get executed output in 'progout' and name of the two tmp files to cleanup [tmpfile,filename,progout] = obj.get_output() os.unlink( tmpfile ) os.unlink( filename ) if obj.exitcode != 0 and EzhilWeb.error_qualifiers(progout): failed = True else: failed = False except Exception as e: exception = str(e) failed = True [tmpfile,filename,progout] = obj.get_output() try: os.unlink( tmpfile ) except Except as e: pass try: os.unlink( filename ) except Except as e: pass #traceback.print_tb(sys.exc_info()[2]) #raise e #debug mode ctx = Context({'evaluated_flag':evaluated, 'failed_flag':failed, 'program_input':progin, 'program_output':progout, 'exception_message':exception}) return StreamingHttpResponse( render(request,"ezplay/eval.html", ctx ) )
def do_ezhil_execute(self,program): # write the input program into a temporary file and execute the Ezhil Interpreter program_fmt = """<TABLE> <TR><TD> <TABLE> <TR> <TD><font color=\"blue\"><OL>""" print( "Source program" ) print( program ) print( "*"*60 ) program_fmt += "\n".join(["<li>%s</li>"%(prog_line) for line_no,prog_line in enumerate(program.split('\n'))]) program_fmt += """</OL></font></TD></TR>\n</TABLE></TD><TD>""" # run the interpreter in a sandbox and capture the output hopefully try: failed = True #default failed mode obj = EzhilFileExecuter( file_input = [program], redirectop = True, TIMEOUT = 60*2 ) # 2 minutes progout = obj.get_output() #SUCCESS_STRING = "<H2> Your program executed correctly! Congratulations. </H2>" FAILED_STRING = "Traceback (most recent call last)" if obj.exitcode != 0 and progout.find(FAILED_STRING) > -1: print "Exitcode => ",obj.exitcode print progout op = "%s <B>FAILED Execution, with parsing or evaluation error</B> for program with <font color=\"red\">error <pre>%s</pre> </font></TD></TR></TABLE>"%(program_fmt,progout) else: failed = False obj.exitcode = 0 op = "%s <B>Succeeded Execution</B> for program with output, <BR/> <font color=\"green\"><pre>%s</pre></font></TD></TR></TABLE>"%(program_fmt,progout) except Exception as e: print "FAILED EXECUTION" print str(e) failed = True op = "%s <B>FAILED Execution</B> for program with <font color=\"red\">error <pre>%s</pre> </font></TD></TR></TABLE>"%(program_fmt,str(e)) else: print "Output file" obj.get_output() prev_page = """<script> document.write("Navigate back to your source program : <a href='#' onClick='history.back();return false;'>Go Back</a>"); </script><HR/>""" #op = "" if failed: op = "<H2> Your program has some errors! Try correcting it and re-evaluate the code</H2><HR/><BR/>"+op else: op = "<H2> Your program executed correctly! Congratulations. </H2><HR/><BR/>"+op op = prev_page + op self.wfile.write("<html> <head> <title>Ezhil interpreter</title> </head><body> %s </body></html>\n"%op) return op
def test_basic_file_settings(self): #print program obj = EzhilFileExecuter( file_input = [program], debug=False, redirectop = True, TIMEOUT = 10 ) # 2 minutes # actually run the process obj.run() # get executed output in 'progout' and name of the two tmp files to cleanup [tmpfile,filename,progout] = obj.get_output() if obj.exitcode != 0 and EzhilWeb.error_qualifiers(progout): failed = True else: failed = False if ( debug ): print (u"output = ") print (u"%s,%s"%(progout.decode('utf-8'), str(failed))) return
def do_ezhil_execute(self, program): # execute the Ezhil Interpreter with string @program print("<html> <head> <title>Ezhil interpreter</title> </head><body> ") print("<!-- ") #suppress exec stdout close_comment = False #and useful to debug a live site program_fmt = """<TABLE> <TR><TD> <TABLE> <TR> <TD><font color=\"blue\"><OL>""" if (self.debug): print("Source program <BR />") print "program = ", program, "<BR />" print("*" * 60) print("<BR />") program_fmt += "\n".join([ "<li>%s</li>" % (prog_line) for line_no, prog_line in enumerate(program.split('\n')) ]) program_fmt += """</OL></font></TD></TR>\n</TABLE></TD><TD>""" sys.stdout.flush() sys.stderr.flush() # run the interpreter in a sandbox and capture the output hopefully try: failed = False obj = EzhilFileExecuter(file_input=[program], redirectop=True, TIMEOUT=60 * 2) # 2 minutes progout = obj.get_output() #SUCCESS_STRING = "<H2> Your program executed correctly! Congratulations. </H2>" if (self.debug): print(obj.exitcode) print(progout) print("-->") close_comment = True if obj.exitcode != 0 and EzhilWeb.error_qualifiers(progout): if (self.debug): print "Exitcode => ", obj.exitcode print progout self.img_outcome = "<IMG width='64' SRC='../icons/%s' alt='failure' />" % EzhilWeb.get_image( 'failure') op = "%s <B>%s Failed Execution, with parsing or evaluation error</B> for program with <font color=\"red\">error <pre>%s</pre> </font></TD></TR></TABLE>" % ( program_fmt, self.img_outcome, progout) failed = True else: failed = False self.img_outcome = "<IMG width='64' SRC='../icons/%s' alt='success' />" % EzhilWeb.get_image( 'success') op = "%s <B>%s Succeeded Execution</B> for program with output, <BR/> <font color=\"green\"><pre>%s</pre></font></TD></TR></TABLE>" % ( program_fmt, self.img_outcome, progout) except Exception as e: if (not close_comment): print("-->") if (self.debug): print "FAILED EXECUTION" print str(e) failed = True self.img_outcome = "<IMG SRC='../icons/%s' width='64' alt='failure' />" % EzhilWeb.get_image( 'failure') op = "%s <B>%s FAILED Execution</B> for program with <font color=\"red\">error <pre>%s</pre> </font></TD></TR></TABLE>" % ( program_fmt, self.img_outcome, str(e)) if (self.debug): print "Output file" print obj.get_output() prev_page = """<script> document.write("Navigate back to your source program : <a href='#' onClick='history.back();return false;'>Go Back</a>"); </script><BR />\n<HR/>\n""" print prev_page #op = self.img_outcome + op if failed: op = "<H2> Your program has some errors! Try correcting it and re-evaluate the code</H2><HR/><BR/>" + op else: op = "<H2> Your program executed correctly! Congratulations. </H2><HR/><BR/>" + op print op print("</body></html>\n") return op
def do_ezhil_execute(self, program): # execute the Ezhil Interpreter with string @program print ("<html> <head> <title>Ezhil interpreter</title> </head><body> ") print ("<!-- ") # suppress exec stdout close_comment = False # and useful to debug a live site program_fmt = """<TABLE> <TR><TD> <TABLE> <TR> <TD><font color=\"blue\"><OL>""" if self.debug: print ("Source program <BR />") print "program = ", program, "<BR />" print ("*" * 60) print ("<BR />") program_fmt += "\n".join(["<li>%s</li>" % (prog_line) for line_no, prog_line in enumerate(program.split("\n"))]) program_fmt += """</OL></font></TD></TR>\n</TABLE></TD><TD>""" sys.stdout.flush() sys.stderr.flush() # run the interpreter in a sandbox and capture the output hopefully try: failed = False obj = EzhilFileExecuter(file_input=[program], redirectop=True, TIMEOUT=60 * 2) # 2 minutes progout = obj.get_output() # SUCCESS_STRING = "<H2> Your program executed correctly! Congratulations. </H2>" if self.debug: print (obj.exitcode) print (progout) print ("-->") close_comment = True if obj.exitcode != 0 and EzhilWeb.error_qualifiers(progout): if self.debug: print "Exitcode => ", obj.exitcode print progout self.img_outcome = "<IMG width='64' SRC='../icons/%s' alt='failure' />" % EzhilWeb.get_image("failure") op = ( '%s <B>%s Failed Execution, with parsing or evaluation error</B> for program with <font color="red">error <pre>%s</pre> </font></TD></TR></TABLE>' % (program_fmt, self.img_outcome, progout) ) failed = True else: failed = False self.img_outcome = "<IMG width='64' SRC='../icons/%s' alt='success' />" % EzhilWeb.get_image("success") op = ( '%s <B>%s Succeeded Execution</B> for program with output, <BR/> <font color="green"><pre>%s</pre></font></TD></TR></TABLE>' % (program_fmt, self.img_outcome, progout) ) except Exception as e: if not close_comment: print ("-->") if self.debug: print "FAILED EXECUTION" print str(e) failed = True self.img_outcome = "<IMG SRC='../icons/%s' width='64' alt='failure' />" % EzhilWeb.get_image("failure") op = ( '%s <B>%s FAILED Execution</B> for program with <font color="red">error <pre>%s</pre> </font></TD></TR></TABLE>' % (program_fmt, self.img_outcome, str(e)) ) if self.debug: print "Output file" print obj.get_output() prev_page = """<script> document.write("Navigate back to your source program : <a href='#' onClick='history.back();return false;'>Go Back</a>"); </script><BR />\n<HR/>\n""" print prev_page # op = self.img_outcome + op if failed: op = "<H2> Your program has some errors! Try correcting it and re-evaluate the code</H2><HR/><BR/>" + op else: op = "<H2> Your program executed correctly! Congratulations. </H2><HR/><BR/>" + op print op print ("</body></html>\n") return op
def do_ezhil_execute(self, program): # execute the Ezhil Interpreter with string @program print("<html> <head> <title>Ezhil interpreter</title>") print("""<script src="./Blob.js"></script> <script src="./FileSaver.js"></script> <script lang="text/javascript"> function download(filename, content) { saveAs( new Blob([content],{type: "application/x-ezhil;charset=utf-8"}), filename); } </script>""") print("</head><body> ") print("<!-- ") #suppress exec stdout close_comment = False #and useful to debug a live site program_fmt = """<TABLE> <TR><TD> <TABLE> <TR> <TD><font color=\"blue\"><OL>""" if (self.debug): print("Source program <BR />") print("program = ", program, "<BR />") print("*" * 60) print("<BR />") program_fmt += "\n".join([ "<li>%s</li>" % (prog_line) for line_no, prog_line in enumerate(program.split('\n')) ]) program_fmt += """</OL></font></TD></TR>\n</TABLE></TD><TD>""" sys.stdout.flush() sys.stderr.flush() # run the interpreter in a sandbox and capture the output hopefully try: failed = False obj = EzhilFileExecuter(file_input=[program], redirectop=True, TIMEOUT=60 * 2) # 2 minutes obj.run() [f1, f2, progout] = obj.get_output() for f in [f1, f2]: try: os.unlink(f) except Exception as e: pass #SUCCESS_STRING = "<H2> Your program executed correctly! Congratulations. </H2>" if (self.debug): print(obj.exitcode) print(progout) print("-->") close_comment = True if obj.exitcode != 0 and EzhilWeb.error_qualifiers(progout): if (self.debug): print("Exitcode => ", obj.exitcode) print(progout) self.img_outcome = "<IMG width='64' SRC='../icons/%s' alt='failure' />" % EzhilWeb.get_image( 'failure') op = "%s <B>%s Failed Execution, with parsing or evaluation error</B> for program with <font color=\"red\">error <pre>%s</pre> </font></TD></TR></TABLE>" % ( program_fmt, self.img_outcome, progout) failed = True else: failed = False self.img_outcome = "<IMG width='64' SRC='../icons/%s' alt='success' />" % EzhilWeb.get_image( 'success') op = "%s <B>%s Succeeded Execution</B> for program with output, <BR/> <font color=\"green\"><pre>%s</pre></font></TD></TR>" % ( program_fmt, self.img_outcome, progout) op = op + saveYourCode(program) op = op + "</TABLE>" except Exception as e: raise e if (not close_comment): print("-->") if (self.debug): print("FAILED EXECUTION") print(str(e)) failed = True self.img_outcome = "<IMG SRC='../icons/%s' width='64' alt='failure' />" % EzhilWeb.get_image( 'failure') op = "%s <B>%s FAILED Execution</B> for program with <font color=\"red\">error <pre>%s</pre> </font></TD></TR>" % ( program_fmt, self.img_outcome, str(e)) op = op + saveYourCode(program) op = op + "</TABLE>" if (self.debug): print("Output file") print(obj.get_output()) prev_page = "<script>\ndocument.write(\"Navigate back to your source program : <a href='#' onClick='history.back();return false;'>Go Back</a>\");\n</script><BR />\n<HR/>\n" print(prev_page) #op = self.img_outcome + op if failed: op = "<H2> Your program has some errors! Try correcting it and re-evaluate the code</H2><HR/><BR/>" + op else: op = "<H2> Your program executed correctly! Congratulations. </H2><HR/><BR/>" + op print(op.decode("utf-8")) print("</body></html>\n") return op
def do_ezhil_execute(self,program): # write the input program into a temporary file and execute the Ezhil Interpreter program_fmt = u"""<TABLE> <TR><TD> <TABLE> <TR> <TD><font color=\"blue\"><OL>""" print( u"Source program" ) print( program ) print( u"*"*60 ) program_fmt += u"\n".join(["<li>%s</li>"%(prog_line) for line_no,prog_line in enumerate(program.split('\n'))]) program_fmt += u"""</OL></font></TD></TR>\n</TABLE></TD><TD>""" # run the interpreter in a sandbox and capture the output hopefully try: failed = True #default failed mode obj = EzhilFileExecuter( file_input = [program], redirectop = True, TIMEOUT = 60*2 ) # 2 minutes # actually run the process obj.run() # get executed output in 'progout' and name of the two tmp files to cleanup [tmpfile,filename,progout] = obj.get_output() for f in [tmpfile,filename]: try: os.unlink( f ) except Exception as e: pass if obj.exitcode != 0: #and EzhilWeb.error_qualifiers(progout) failed = True else: failed = False # output from ezhil interpreter is in form of UTF-8 strings, we extract # it from ASCII format I/O since we are in CGI mode. progout = progout.decode('utf-8') if DEBUG: print u"output = " print progout #SUCCESS_STRING = "<H2> Your program executed correctly! Congratulations. </H2>" FAILED_STRING = "Traceback (most recent call last)" if obj.exitcode != 0 and progout.find(FAILED_STRING) > -1: print u"Exitcode => ",obj.exitcode op = u"%s <B>FAILED Execution, with parsing or evaluation error</B> for program with <font color=\"red\">error <pre>%s</pre> </font></TD></TR></TABLE>"%(program_fmt,progout) else: failed = False obj.exitcode = 0 op = u"%s <B>Succeeded Execution</B> for program with output, <BR/> <font color=\"green\"><pre>%s</pre></font></TD></TR></TABLE>"%(program_fmt,progout) except Exception as e: print u"FAILED EXECUTION" print str(e) traceback.print_tb(sys.exc_info()[2]) failed = True op = u"%s <B>FAILED Execution</B> for program with <font color=\"red\">error <pre>%s</pre> </font></TD></TR></TABLE>"%(program_fmt,str(e)) else: print u"Output file" obj.get_output() prev_page = u"""<script> document.write("Navigate back to your source program : <a href='#' onClick='history.back();return false;'>Go Back</a>"); </script><HR/>""" #op = "" if failed: op = u"<H2> Your program has some errors! Try correcting it and re-evaluate the code</H2><HR/><BR/>"+op else: op = u"<H2> Your program executed correctly! Congratulations. </H2><HR/><BR/>"+op op = prev_page + op real_op = u"<html> <head> <title>Ezhil interpreter</title> </head><body> %s </body></html>\n"%op # CGI pipe only allows ASCII style strings self.wfile.write(real_op.encode('utf-8')) return op
def do_ezhil_execute(self, program): # write the input program into a temporary file and execute the Ezhil Interpreter program_fmt = """<TABLE> <TR><TD> <TABLE> <TR> <TD><font color=\"blue\"><OL>""" print("Source program") print(program) print("*" * 60) program_fmt += "\n".join([ "<li>%s</li>" % (prog_line) for line_no, prog_line in enumerate(program.split('\n')) ]) program_fmt += """</OL></font></TD></TR>\n</TABLE></TD><TD>""" # run the interpreter in a sandbox and capture the output hopefully try: failed = True #default failed mode obj = EzhilFileExecuter(file_input=[program], redirectop=True, TIMEOUT=60 * 2) # 2 minutes progout = obj.get_output() #SUCCESS_STRING = "<H2> Your program executed correctly! Congratulations. </H2>" FAILED_STRING = "Traceback (most recent call last)" if obj.exitcode != 0 and progout.find(FAILED_STRING) > -1: print "Exitcode => ", obj.exitcode print progout op = "%s <B>FAILED Execution, with parsing or evaluation error</B> for program with <font color=\"red\">error <pre>%s</pre> </font></TD></TR></TABLE>" % ( program_fmt, progout) else: failed = False obj.exitcode = 0 op = "%s <B>Succeeded Execution</B> for program with output, <BR/> <font color=\"green\"><pre>%s</pre></font></TD></TR></TABLE>" % ( program_fmt, progout) except Exception as e: print "FAILED EXECUTION" print str(e) failed = True op = "%s <B>FAILED Execution</B> for program with <font color=\"red\">error <pre>%s</pre> </font></TD></TR></TABLE>" % ( program_fmt, str(e)) else: print "Output file" obj.get_output() prev_page = """<script> document.write("Navigate back to your source program : <a href='#' onClick='history.back();return false;'>Go Back</a>"); </script><HR/>""" #op = "" if failed: op = "<H2> Your program has some errors! Try correcting it and re-evaluate the code</H2><HR/><BR/>" + op else: op = "<H2> Your program executed correctly! Congratulations. </H2><HR/><BR/>" + op op = prev_page + op self.wfile.write( "<html> <head> <title>Ezhil interpreter</title> </head><body> %s </body></html>\n" % op) return op
def do_ezhil_execute(self, program): # write the input program into a temporary file and execute the Ezhil Interpreter program_fmt = u"""<TABLE> <TR><TD> <TABLE> <TR> <TD><font color=\"blue\"><OL>""" print(u"Source program") print(program) print(u"*" * 60) program_fmt += u"\n".join([ "<li>%s</li>" % (prog_line) for line_no, prog_line in enumerate(program.split('\n')) ]) program_fmt += u"""</OL></font></TD></TR>\n</TABLE></TD><TD>""" # run the interpreter in a sandbox and capture the output hopefully try: failed = True #default failed mode obj = EzhilFileExecuter(file_input=[program], redirectop=True, TIMEOUT=60 * 2) # 2 minutes # actually run the process obj.run() # get executed output in 'progout' and name of the two tmp files to cleanup [tmpfile, filename, progout] = obj.get_output() for f in [tmpfile, filename]: try: os.unlink(f) except Exception as e: pass if obj.exitcode != 0: #and EzhilWeb.error_qualifiers(progout) failed = True else: failed = False # output from ezhil interpreter is in form of UTF-8 strings, we extract # it from ASCII format I/O since we are in CGI mode. progout = progout.decode('utf-8') if DEBUG: print(u"output = ") print(progout) #SUCCESS_STRING = "<H2> Your program executed correctly! Congratulations. </H2>" FAILED_STRING = "Traceback (most recent call last)" if obj.exitcode != 0 and progout.find(FAILED_STRING) > -1: print(u"Exitcode => ", obj.exitcode) op = u"%s <B>FAILED Execution, with parsing or evaluation error</B> for program with <font color=\"red\">error <pre>%s</pre> </font></TD></TR></TABLE>" % ( program_fmt, progout) else: failed = False obj.exitcode = 0 op = u"%s <B>Succeeded Execution</B> for program with output, <BR/> <font color=\"green\"><pre>%s</pre></font></TD></TR></TABLE>" % ( program_fmt, progout) except Exception as e: print(u"FAILED EXECUTION", str(e)) traceback.print_tb(sys.exc_info()[2]) failed = True op = u"%s <B>FAILED Execution</B> for program with <font color=\"red\">error <pre>%s</pre> </font></TD></TR></TABLE>" % ( program_fmt, str(e)) else: print(u"Output file") obj.get_output() prev_page = u"""<script> document.write("Navigate back to your source program : <a href='#' onClick='history.back();return false;'>Go Back</a>"); </script><HR/>""" #op = "" if failed: op = u"<H2> Your program has some errors! Try correcting it and re-evaluate the code</H2><HR/><BR/>" + op else: op = u"<H2> Your program executed correctly! Congratulations. </H2><HR/><BR/>" + op op = prev_page + op real_op = u"<html> <head> <title>Ezhil interpreter</title> </head><body> %s </body></html>\n" % op # CGI pipe only allows ASCII style strings self.wfile.write(real_op.encode('utf-8')) return op
def do_ezhil_execute(self, program): # execute the Ezhil Interpreter with string @program print("<html> <head> <title>Ezhil interpreter</title>") print( """<script src="./Blob.js"></script> <script src="./FileSaver.js"></script> <script lang="text/javascript"> function download(filename, content) { saveAs( new Blob([content],{type: "application/x-ezhil;charset=utf-8"}), filename); } </script>""" ) print("</head><body> ") print("<!-- ") # suppress exec stdout close_comment = False # and useful to debug a live site program_fmt = """<TABLE> <TR><TD> <TABLE> <TR> <TD><font color=\"blue\"><OL>""" if self.debug: print("Source program <BR />") print("program = ", program, "<BR />") print("*" * 60) print("<BR />") program_fmt += "\n".join(["<li>%s</li>" % (prog_line) for line_no, prog_line in enumerate(program.split("\n"))]) program_fmt += """</OL></font></TD></TR>\n</TABLE></TD><TD>""" sys.stdout.flush() sys.stderr.flush() # run the interpreter in a sandbox and capture the output hopefully try: failed = False obj = EzhilFileExecuter(file_input=[program], redirectop=True, TIMEOUT=60 * 2) # 2 minutes obj.run() [f1, f2, progout] = obj.get_output() for f in [f1, f2]: try: os.unlink(f) except Exception as e: pass # SUCCESS_STRING = "<H2> Your program executed correctly! Congratulations. </H2>" if self.debug: print(obj.exitcode) print(progout) print("-->") close_comment = True if obj.exitcode != 0 and EzhilWeb.error_qualifiers(progout): if self.debug: print("Exitcode => ", obj.exitcode) print(progout) self.img_outcome = "<IMG width='64' SRC='../icons/%s' alt='failure' />" % EzhilWeb.get_image("failure") op = ( '%s <B>%s Failed Execution, with parsing or evaluation error</B> for program with <font color="red">error <pre>%s</pre> </font></TD></TR></TABLE>' % (program_fmt, self.img_outcome, progout) ) failed = True else: failed = False self.img_outcome = "<IMG width='64' SRC='../icons/%s' alt='success' />" % EzhilWeb.get_image("success") op = ( '%s <B>%s Succeeded Execution</B> for program with output, <BR/> <font color="green"><pre>%s</pre></font></TD></TR>' % (program_fmt, self.img_outcome, progout) ) op = op + saveYourCode(program) op = op + "</TABLE>" except Exception as e: raise e if not close_comment: print("-->") if self.debug: print("FAILED EXECUTION") print(str(e)) failed = True self.img_outcome = "<IMG SRC='../icons/%s' width='64' alt='failure' />" % EzhilWeb.get_image("failure") op = ( '%s <B>%s FAILED Execution</B> for program with <font color="red">error <pre>%s</pre> </font></TD></TR>' % (program_fmt, self.img_outcome, str(e)) ) op = op + saveYourCode(program) op = op + "</TABLE>" if self.debug: print("Output file") print(obj.get_output()) prev_page = "<script>\ndocument.write(\"Navigate back to your source program : <a href='#' onClick='history.back();return false;'>Go Back</a>\");\n</script><BR />\n<HR/>\n" print(prev_page) # op = self.img_outcome + op if failed: op = "<H2> Your program has some errors! Try correcting it and re-evaluate the code</H2><HR/><BR/>" + op else: op = "<H2> Your program executed correctly! Congratulations. </H2><HR/><BR/>" + op print(op.decode("utf-8")) print("</body></html>\n") return op