Use StringIO instead of BytesIO for Python 2.5