title: What is producing "TypeError character mapping must return integer..." in this python code?
body: <p>please, can someone help me with the code bellow?
  When I run it the logs said: </p>
  
  <pre><code>return method(*args, **kwargs)
    File "C:\Users\CG\Documents\udacity\rot13serendipo\main.py", line 51, in post
      text = rot13(text)
    File "C:\Users\CG\Documents\udacity\rot13serendipo\main.py", line 43, in rot13
      return st.translate(tab)
  TypeError: character mapping must return integer, None or unicode
     INFO     2012-04-28 20:02:26,862 dev_appserver.py:2891] "POST / HTTP/1.1" 500 -
  </code></pre>
  
  <p>I know the error must be in rot13(). But when I run this procedure in the IDE it works normally. </p>
  
  <p>Here my code:</p>
  
  <pre><code>import webapp2
  
  form= """
    &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;Unit 2 Rot 13&lt;/title&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
      &lt;h2&gt;Enter some text to ROT13:&lt;/h2&gt;
      &lt;form method="post"&gt;
        &lt;textarea name="text"
                  style="height: 100px; width: 400px;"&gt;&lt;/textarea&gt;
        &lt;br&gt;
        &lt;input type="submit"&gt;
      &lt;/form&gt;
    &lt;/body&gt;
  
    &lt;/html&gt; """
  
  def rot13(st):
      import string
      tab1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
      tab2 = 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'
      tab = string.maketrans(tab1, tab2)
      return st.translate(tab)
  
  class MainHandler(webapp2.RequestHandler):
      def get(self):
          self.response.out.write(form)
  
      def post(self):
          text = self.request.get("text")
          text = rot13(text)
          self.response.out.write(text)
  
  
  app = webapp2.WSGIApplication([('/', MainHandler)],
                            debug=True)
  </code></pre>
  
  <p>Thanks in advance for any help!</p>