#!/usr/bin/python3 import cgi, cgitb form = cgi.FieldStorage() AZ = form.getvalue('AZ') A=form.getvalue('A') Z=form.getvalue('Z') import os, subprocess os.chdir(r"files") result = ""; if 'AZ' in form: result=subprocess.run(['../Cleopatra/IsotopeShort', AZ], stdout=subprocess.PIPE).stdout.decode('utf-8') if 'A' in form: result=subprocess.run(['../Cleopatra/IsotopeShort', A, Z], stdout=subprocess.PIPE).stdout.decode('utf-8') print( "Content-type:text/html\r\n\r\n") #print("") #print("
") if result != "": pA = result.find('A:') pZ = result.find('Z:') p1 = result.find('Mass:') p2 = result.find('Name:') p2a = result.find('|') print(int(result[pA+2:pA+5]), ",", int(result[pZ+2:pZ+5]), ",", float(result[p1+5:p1+13+5]), ",", result[p2+5: p2a]) else: print("error"); #print("