title: I get 500 Internal Server Error when opening a python file on the browser
body: <p>I can't get my python files to open. I am new at using python, I come from a PHP background and this is completely different for me.
  I created a test file on the server `public_html/python/index.py' with a simple hello world code: </p>
  
  <pre><code>#!/usr/bin/python
  
  print 'Content-type: text/html\r\n'
  print '\r\n'
  print 'Hello, World!'
  </code></pre>
  
  <p>I have been looking around and apparenlty I needed to do some configuration steps in order to run python files.</p>
  
  <p>On shell y made sure that python is installed by running <code>python</code> and worked:</p>
  
  <pre><code>Python 2.4.3 (#1, Feb 22 2012, 16:05:45) 
  [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt;
  </code></pre>
  
  <p>Then I looked for the correct path where python was instsalled <code>type -p python</code> and it is correct: </p>
  
  <pre><code>user@domain.com [~]# type -p python
  /usr/bin/python
  </code></pre>
  
  <p>Finally I read in a blog that in order to execute python files oustide the cgi-bin folder I needed to modify my .htaccess file with the following lines:</p>
  
  <pre><code>Options +ExecCGI
  AddHandler cgi-script .cgi .pl .py
  </code></pre>
  
  <p>This didn't work either, but even if I try to run it inside the <code>cgi-bin</code> folder I still get the same error.</p>
  
  <p>Just in case I also changed the permissions of the file, and nothing:</p>
  
  <pre><code>user@domain.com [~]# chmod a+x public_html/python/index.py
  </code></pre>
  
  <p>After all of this I still get a 500 Internal Server Error when I try to open the url on the web browser.</p>
  
  <p>When I execute <code>od index.py -c</code> I get the following:</p>
  
  <pre><code>0000000   #   !   /   u   s   r   /   b   i   n   /   p   y   t   h   o
  0000020   n  \r  \n  \r  \n   p   r   i   n   t       '   C   o   n   t
  0000040   e   n   t   -   t   y   p   e   :       t   e   x   t   /   h
  0000060   t   m   l   \   r   \   n   '  \r  \n   p   r   i   n   t    
  0000100   '   \   r   \   n   '  \r  \n   p   r   i   n   t       '   H
  0000120   e   l   l   o   ,       W   o   r   l   d   !   '
  0000135
  </code></pre>
  
  <p>Thanks for the help and guidance to this humble python newbie.
  BTW I am using WHM and CPanel in a dedicated server.</p>