title: CGI not executing python - 500 internal server error
body: <p>I have a few python scripts that I'd like to execute and the following configuration: 
  Ubuntu 10.04, Apache2, Python 2.6, mod_python and mod_wsgi installed. </p>
  
  <p>I've followed the instructions on the following sites: </p>
  
  <p><a href="http://bytes.com/topic/python/answers/474462-apache-python-ubuntu" rel="nofollow">http://bytes.com/topic/python/answers/474462-apache-python-ubuntu</a></p>
  
  <p><a href="http://apache.active-venture.com/cgi-configure.html" rel="nofollow">http://apache.active-venture.com/cgi-configure.html</a></p>
  
  <p><a href="http://modpython.org/live/current/doc-html/inst-testing.html" rel="nofollow">http://modpython.org/live/current/doc-html/inst-testing.html</a></p>
  
  <p><a href="http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide" rel="nofollow">http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide</a></p>
  
  <p><a href="http://wiki.apache.org/httpd/DistrosDefaultLayout" rel="nofollow">http://wiki.apache.org/httpd/DistrosDefaultLayout</a></p>
  
  <p>The default file in sites-available :</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerAdmin webmaster@localhost
  
      DocumentRoot /var/www
      &lt;Directory /&gt;
              Options FollowSymLinks
              AllowOverride None
      &lt;/Directory&gt;
  
      &lt;Directory /var/www/&gt;
              Options Indexes FollowSymLinks MultiViews
              AllowOverride None
              Order allow,deny
              allow from all
      &lt;/Directory&gt;
  
      ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
      &lt;Directory "/usr/lib/cgi-bin"&gt;
              AddHandler mod_python .py
              AddHandler cgi-script .cgi py
              AllowOverride None
              Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
              Order allow,deny
              Allow from all
      &lt;/Directory&gt;
  </code></pre>
  
  <p></p>
  
  <p>I'm getting the 500 internal server error. 
  I've also changed the permissions of the files to 755 </p>
  
  <p>The py files simply prints some text that should appear on the page. 
  What should I do?
  Thanks</p>
  
  <p><strong>[edit]: Update, it's related to bugs in the py file</strong>
  error log shown below. </p>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/lib/cgi-bin/amissa2.py", line 80, in &lt;module&gt;
      zoom_factor = int(parms.getfirst('zoom')) * int(parms.getfirst('zsize'))
  TypeError: int() argument must be a string or a number, not 'NoneType'
  </code></pre>
  
  <p>It appears to be an error in converting from None to int, over here: </p>
  
  <pre><code>zoom_factor = int(parms.getfirst('zoom')) * int(parms.getfirst('zsize'))
  </code></pre>
  
  <p>Any hint on how this can such a conversion be done? </p>