title: How to solve "No module named 'cStringIO'" when importing the logging module in Python 3
body: <p>I'm trying to run the following script, named <code>msgpack_checker.py</code>, in Python 3:</p>
  
  <pre><code>import msgpack
  from faker import Faker
  import logging
  from logging.handlers import RotatingFileHandler
  
  fake = Faker()
  fake.seed(0)
  
  data_file = "my_log.log"
  
  logger = logging.getLogger('my_logger')
  logger.setLevel(logging.DEBUG)
  handler = RotatingFileHandler(data_file, maxBytes=2000, backupCount=10)
  handler.terminator = ""         # Suppress the newline character (only works in Python 3)
  logger.addHandler(handler)
  
  fake_dicts = [{'name': fake.name()} for _ in range(100)]
  
  for item in fake_dicts:
      dump_string = msgpack.packb(item)
      # print dump_string
      logger.debug(dump_string)
  
  unpacker = msgpack.Unpacker(open(data_file))
  
  print("Printing unpacked contents:")
  for unpacked in unpacker:
      print(unpacked)
  </code></pre>
  
  <p>when I run it with Python 2, it prints the following output:</p>
  
  <pre><code>Printing unpacked contents:
  {'name': 'Joshua Carter'}
  10
  {'name': 'David Williams'}
  10
  {'name': 'Joseph Jones'}
  10
  {'name': 'Gary Perry'}
  10
  {'name': 'Terry Wells'}
  10
  {'name': 'Vanessa Cooper'}
  10
  {'name': 'Michael Simmons'}
  10
  {'name': 'Nicholas Kline'}
  10
  {'name': 'Lori Bennett'}
  10
  </code></pre>
  
  <p>The numbers "10" I believe come from the logger, and should be removed in Python 3 by the <code>handler.terminator = ""</code> command. However, if I try to run the script using <code>python3 msgpack_checker.py</code>, I get the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "msgpack_checker.py", line 3, in &lt;module&gt;
      import logging
    File "/home/kurt/Documents/Scratch/logging/__init__.py", line 26, in &lt;module&gt;
      import sys, os, time, cStringIO, traceback, warnings, weakref
  ImportError: No module named 'cStringIO'
  </code></pre>
  
  <p>Apparently the <code>logging</code> module tries to import <code>cStringIO</code> directly, which no longer exists in Python 3. I've seen fixes which involve importing <code>StringIO</code> from <code>io</code> instead of <code>StringIO</code>, but I not sure they would work here. Any suggestions on how to get this script to work in Python 3?</p>