Replaced print statements with print function.

This is needed for Python3 compatibility.

Change-Id: Iadd21e4b3a936b601a69f1db2aba8e1597f13fc3
This commit is contained in:
Alex Gaynor 2014-03-30 12:47:40 -07:00
parent e3b7ecd2bb
commit 1d0c97fdb3
2 changed files with 25 additions and 12 deletions

@ -12,6 +12,9 @@
# implied. # implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
from itertools import chain from itertools import chain
import sys import sys
from time import sleep from time import sleep
@ -258,7 +261,7 @@ class MultiThreadingManager(object):
stream = self.print_stream stream = self.print_stream
if isinstance(item, unicode): if isinstance(item, unicode):
item = item.encode('utf8') item = item.encode('utf8')
print >>stream, item print(item, file=stream)
def _print_error(self, item): def _print_error(self, item):
self.error_count += 1 self.error_count += 1

@ -13,6 +13,9 @@
# implied. # implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import print_function
import signal import signal
import socket import socket
import logging import logging
@ -233,9 +236,11 @@ def st_delete(parser, args, thread_manager):
thread_manager.error('Account not found') thread_manager.error('Account not found')
elif len(args) == 1: elif len(args) == 1:
if '/' in args[0]: if '/' in args[0]:
print >> stderr, 'WARNING: / in container name; you ' \ print(
'might have meant %r instead of %r.' % ( 'WARNING: / in container name; you might have meant '
args[0].replace('/', ' ', 1), args[0]) '%r instead of %r.' % (
args[0].replace('/', ' ', 1), args[0]),
file=stderr)
container_queue.put(args[0]) container_queue.put(args[0])
else: else:
for obj in args[1:]: for obj in args[1:]:
@ -497,10 +502,11 @@ def st_download(parser, args, thread_manager):
thread_manager.error('Account not found') thread_manager.error('Account not found')
elif len(args) == 1: elif len(args) == 1:
if '/' in args[0]: if '/' in args[0]:
print >> stderr, ( print(
'WARNING: / in container name; you might have meant ' 'WARNING: / in container name; you might have meant '
'%r instead of %r.' % ( '%r instead of %r.' % (
args[0].replace('/', ' ', 1), args[0])) args[0].replace('/', ' ', 1), args[0]),
file=stderr)
container_queue.put((args[0], object_queue, options.prefix)) container_queue.put((args[0], object_queue, options.prefix))
else: else:
if len(args) == 2: if len(args) == 2:
@ -664,9 +670,11 @@ def st_stat(parser, args, thread_manager):
thread_manager.error('Account not found') thread_manager.error('Account not found')
elif len(args) == 1: elif len(args) == 1:
if '/' in args[0]: if '/' in args[0]:
print >> stderr, 'WARNING: / in container name; you might have ' \ print(
'meant %r instead of %r.' % \ 'WARNING: / in container name; you might have meant %r instead'
(args[0].replace('/', ' ', 1), args[0]) ' of %r.' % (
args[0].replace('/', ' ', 1), args[0]),
file=stderr)
try: try:
command_helpers.stat_container(conn, options, args, command_helpers.stat_container(conn, options, args,
thread_manager) thread_manager)
@ -758,9 +766,11 @@ def st_post(parser, args, thread_manager):
thread_manager.error('Account not found') thread_manager.error('Account not found')
elif len(args) == 1: elif len(args) == 1:
if '/' in args[0]: if '/' in args[0]:
print >> stderr, 'WARNING: / in container name; you might have ' \ print(
'meant %r instead of %r.' % \ 'WARNING: / in container name; you might have meant %r instead'
(args[0].replace('/', ' ', 1), args[0]) ' of %r.' % (
args[0].replace('/', ' ', 1), args[0]),
file=stderr)
headers = split_headers(options.meta, 'X-Container-Meta-', headers = split_headers(options.meta, 'X-Container-Meta-',
thread_manager) thread_manager)
headers.update(split_headers(options.header, '', thread_manager)) headers.update(split_headers(options.header, '', thread_manager))