#!/usr/bin/python3

import cgi, cgitb

form = cgi.FieldStorage()

V0 = form.getvalue('V0')
R0 = form.getvalue('R0')
a0 = form.getvalue('a0')
VSO = form.getvalue('VSO')
RSO = form.getvalue('RSO')
aSO = form.getvalue('aSO')
Z = form.getvalue('Z')
Rc = form.getvalue('Rc')
nStep = form.getvalue('nStep')
dr = form.getvalue('dr')

import os, subprocess
os.chdir(r"files")

result = subprocess.run(['../Woods-Saxon/WSCal', V0, R0, a0, VSO, RSO, aSO, Z, Rc, nStep, dr],  stdout=subprocess.PIPE).stdout.decode('utf-8')

print( "Content-type:text/html\r\n\r\n")
print(result)