title: Blank page running python script
body: <p>I have a HTML-page from which I pass some input values to a python script to be processed there. What I want to do is to show the results of the calculations. Just on a white page. No formatting or anything. Just plain numbers. </p>
  
  <p>The problem is that I am getting just a blank page and I can't figure out why. </p>
  
  <p>I did a lot of research but none of the solutions provided applied direclty to my issue. </p>
  
  <p>It seems that the values are being passed on and processed since i don't get an error message nor there is an error in the error log nor any indications in the web console. </p>
  
  <p>I am running a LAMP webserver which apache2 on it. The apache2 is correctly configured for running python and cgi. </p>
  
  <p>HTML: </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
     &lt;head&gt;
        &lt;meta charset="utf-8"&gt;
        &lt;title&gt;Eval Main&lt;/title&gt;
        &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;
     &lt;/head&gt;
     &lt;body&gt;
        &lt;script type="text/javascript"&gt;
           $(function()
           {
               $('#ok').click(function()
               {
                   $.ajax(
                   {
                       url: "/cgi-bin/verlauf_Grenzen.py",
                       data:
                       {
                           a_test: $("#testa").val(),
                           v_test: $("#testv").val(),
                           s_test: $("#tests").val(),
                           j_test: $("#testj").val()
                       },
                       success: function(response)
                       {
                           handleResponse(response);
                       }
                   });
               });
           });
        &lt;/script&gt;
        &lt;form action="/cgi-bin/verlauf_Grenzen.py" method="POST"&gt;
           &lt;input id="testa" type="number" name="a" /&gt;
           &lt;input id="testv" type="number" name="v" /&gt;
           &lt;input id="tests" type="number" name="s" /&gt;
           &lt;input id="testj" type="number" name="j" /&gt;
           &lt;button id="ok" type="submit" value="Submit"&gt;Click&lt;/button&gt;
        &lt;/form&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>verlauf_Grenzen.py</p>
  
  <pre><code>    #!/usr/local/bin/python3.6
  
      import json, time, glob, os
      import numpy as np
      from ruck import Cases
      import cgi, cgitb
  
      cgitb.enable()
  
      print("Content-type:text/html\n")
  
      def index(req):
          form = cgi.FieldStorage()
  
          a = form.getvalue('a_test')
          v = form.getvalue('v_test')
          s = form.getvalue('s_test')
          j = form.getvalue('j_test')
  
          cases = Cases(a,v,s,j)
  
          #does something here
  
          return x #x ist a single number
  
          print("&lt;html&gt;")
          print("&lt;head&gt;")
          print("&lt;title&gt;CALC&lt;/title&gt;")
          print("&lt;/head&gt;")
          print("&lt;body&gt;")
          print("&lt;h2&gt;Your name is {} &lt;/h2&gt;".format(x))
          print("&lt;/body&gt;")
          print("&lt;/html&gt;")
          req.write(x)
  </code></pre>
  
  <p>ruck.py</p>
  
  <pre><code>        #!/usr/local/bin/python3.6
  
          import cgi, cgitb
  
          cgitb.enable()
  
          class Cases(object):
  
              def __init__(self, a, v, s, j):
                  self.a = a
                  self.v = v
                  self.s = s
                  self.j = j
  
             # does something here (a few functions/methods)
  
                  return x, tj, ta, tv, tg, self.v, self.a
  
              def __call__(self):
                  self.case_one()
                  self.case_two()
                  self.case_three()
                  self.case_four()
  </code></pre>
  
  <p>Both scripts work fine and cause no errors.
  Thanks for any help in advance. I am pretty new in web programming.</p>