title: premature end of script headers in python script
body: <p>I just finished coding in Python a simple battleship game. In terminal,it runs perfectly,but when i try to run it online as a cgi-bin script,there are problems.
  My code is:</p>
  
  <pre><code>#!/usr/bin/python
  
  print "Content-type: text/html\n\n"
  print "&lt;html&gt;"
  
  from random import randint
  
  board = []
  
  for x in range(0,5):
    board.append(["O"] * 5)
  
  def print_board(board):
    for row in board:
      print " ".join(row)
  
  print_board(board)
  
  def random_row(board):
    return random.randint(0,len(board)-1)
  
  def random_col(board):
    return random.randint(0,len(board[0])-1)
  
  ship_row = random_row(board)
  ship_col = random_col(board)
  guess_row = raw_input("Guess Row:")
  guess_col = raw_input("Guess Col:")
  
  print ship_row
  print ship_col
  
  if (guess_row == ship_row and guess_col == ship_col):
  print "Congratulations! You sank my battleship!&lt;br/&gt;"
  else:
  if board[guess_row][guess_col] == "X":
  print "You guessed that one already.&lt;br/&gt;"
  if not (0 &lt;= guess_row &lt; len(board)) or not (0 &lt;= guess_col &lt; len(board)):
  print "Oops, that’s not even in the ocean.&lt;br/&gt;"
  else:
  print "You missed my battleship!&lt;br/&gt;"
  board[guess_row][guess_col] == "X"
  print_board(board)
  
  print "&lt;/html&gt;"
  </code></pre>
  
  <p>I should mention that other simple hello-world scripts run alright in the webpage.
  the error log returns those lines according to this:</p>
  
  <pre><code>[Sun Jan 06 20:34:26 2013] [error] [client xxx]   File "
  [Sun Jan 06 20:34:26 2013] [error] [client xxx] /usr/lib/cgi-bin/game.py
  [Sun Jan 06 20:34:26 2013] [error] [client xxx] ", line
  [Sun Jan 06 20:34:26 2013] [error] [client xxx] 34
  [Sun Jan 06 20:34:26 2013] [error] [client xxx]
  [Sun Jan 06 20:34:26 2013] [error] [client xxx]
  [Sun Jan 06 20:34:26 2013] [error] [client xxx] print "Congratulations! You sank my battleship!&lt;br/&gt;"
  [Sun Jan 06 20:34:26 2013] [error] [client xxx]
  [Sun Jan 06 20:34:26 2013] [error] [client xxx]
  [Sun Jan 06 20:34:26 2013] [error] [client xxx]
  [Sun Jan 06 20:34:26 2013] [error] [client xxx]
  [Sun Jan 06 20:34:26 2013] [error] [client xxx]
  [Sun Jan 06 20:34:26 2013] [error] [client xxx] ^
  [Sun Jan 06 20:34:26 2013] [error] [client xxx] IndentationError
  [Sun Jan 06 20:34:26 2013] [error] [client xxx] :
  [Sun Jan 06 20:34:26 2013] [error] [client xxx] expected an indented block
  [Sun Jan 06 20:34:26 2013] [error] [client xxx]
  [Sun Jan 06 20:34:26 2013] [error] [client xxx] Premature end of script headers: game.py
  </code></pre>
  
  <p>Can you help me with this over here?</p>
  
  <p>Thanks in advance!</p>
  
  <p>ps: i'm new in python :D </p>