Use six.StringIO/BytesIO instead of StringIO.StringIO
to keep Python 3.x compatibility, use six.StringIO/BytesIO to replace StringIO.StringIO StringIO works for unicode BytesIO works for bytes Change-Id: I063d62a4f005084f4088da403f348ad97656ad45 Partial-Bug: #1280100
This commit is contained in:
parent
96d8025ae0
commit
b3ecf6534f
|
@ -19,7 +19,7 @@ import argparse
|
|||
import gzip
|
||||
import os
|
||||
import re
|
||||
import StringIO
|
||||
import six
|
||||
import sys
|
||||
import urllib2
|
||||
|
||||
|
@ -71,7 +71,7 @@ def process_files(file_specs, url_specs, whitelists):
|
|||
req = urllib2.Request(url)
|
||||
req.add_header('Accept-Encoding', 'gzip')
|
||||
page = urllib2.urlopen(req)
|
||||
buf = StringIO.StringIO(page.read())
|
||||
buf = six.StringIO(page.read())
|
||||
f = gzip.GzipFile(fileobj=buf)
|
||||
if scan_content(name, f.read().splitlines(), regexp, whitelist):
|
||||
logs_with_errors.append(name)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
import gzip
|
||||
import pprint
|
||||
import re
|
||||
import StringIO
|
||||
import six
|
||||
import sys
|
||||
import urllib2
|
||||
|
||||
|
@ -68,7 +68,7 @@ def hunt_for_stacktrace(url):
|
|||
req = urllib2.Request(url)
|
||||
req.add_header('Accept-Encoding', 'gzip')
|
||||
page = urllib2.urlopen(req)
|
||||
buf = StringIO.StringIO(page.read())
|
||||
buf = six.StringIO(page.read())
|
||||
f = gzip.GzipFile(fileobj=buf)
|
||||
content = f.read()
|
||||
|
||||
|
|
Loading…
Reference in New Issue