title: AttributeError: 'module' object has no attribute 'maketrans' while running cProfile
body: <p>Using python 2.7 I get this error:</p>
  
  <pre><code>    Traceback (most recent call last):
    File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
      "__main__", fname, loader, pkg_name)
    File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
      exec code in run_globals
    File "/usr/lib/python2.7/cProfile.py", line 199, in &lt;module&gt;
      main()
    File "/usr/lib/python2.7/cProfile.py", line 165, in main
      from optparse import OptionParser
    File "/usr/lib/python2.7/optparse.py", line 77, in &lt;module&gt;
      import textwrap
    File "/usr/lib/python2.7/textwrap.py", line 32, in &lt;module&gt;
      class TextWrapper:
    File "/usr/lib/python2.7/textwrap.py", line 74, in TextWrapper
      whitespace_trans = string.maketrans(_whitespace, ' ' * len(_whitespace))
  AttributeError: 'module' object has no attribute 'maketrans'
  </code></pre>
  
  <p>while running this simple code:</p>
  
  <pre><code>def blah():
      orig = ""
      for i in range(1000000):
          orig += "zim";
  blah()
  </code></pre>
  
  <p>using this call:</p>
  
  <pre><code>$ python -m cProfile string.py
  </code></pre>
  
  <p>I'm using Ubuntu Natty Narwhal, and installed the package python-profiler (I don't know if this is necessary).</p>