Use print function

pull/10690/head
Amandine Lee 10 years ago
parent 3d2a056ad4
commit 683c2913c5

@ -101,7 +101,7 @@ class ActionModule(ActionBase):
try: try:
if not pause_type == 'prompt': if not pause_type == 'prompt':
print "(^C-c = continue early, ^C-a = abort)" print("(^C-c = continue early, ^C-a = abort)")
#print("[%s]\nPausing for %s seconds" % (hosts, seconds)) #print("[%s]\nPausing for %s seconds" % (hosts, seconds))
print("[%s]\nPausing for %s seconds" % (self._task.get_name().strip(), seconds)) print("[%s]\nPausing for %s seconds" % (self._task.get_name().strip(), seconds))
time.sleep(seconds) time.sleep(seconds)
@ -112,7 +112,7 @@ class ActionModule(ActionBase):
result['user_input'] = raw_input(prompt.encode(sys.stdout.encoding)) result['user_input'] = raw_input(prompt.encode(sys.stdout.encoding))
except KeyboardInterrupt: except KeyboardInterrupt:
while True: while True:
print '\nAction? (a)bort/(c)ontinue: ' print('\nAction? (a)bort/(c)ontinue: ')
c = getch() c = getch()
if c == 'c': if c == 'c':
# continue playbook evaluation # continue playbook evaluation

@ -30,7 +30,7 @@ from ansible.plugins.cache.base import BaseCacheModule
try: try:
import memcache import memcache
except ImportError: except ImportError:
print 'python-memcached is required for the memcached fact cache' print('python-memcached is required for the memcached fact cache')
sys.exit(1) sys.exit(1)

@ -28,7 +28,7 @@ from ansible.plugins.cache.base import BaseCacheModule
try: try:
from redis import StrictRedis from redis import StrictRedis
except ImportError: except ImportError:
print "The 'redis' python module is required, 'pip install redis'" print("The 'redis' python module is required, 'pip install redis'")
sys.exit(1) sys.exit(1)
class CacheModule(BaseCacheModule): class CacheModule(BaseCacheModule):

@ -43,14 +43,14 @@ class Display:
if not log_only: if not log_only:
if not stderr: if not stderr:
try: try:
print msg2 print(msg2)
except UnicodeEncodeError: except UnicodeEncodeError:
print msg2.encode('utf-8') print(msg2.encode('utf-8'))
else: else:
try: try:
print >>sys.stderr, msg2 print(msg2, file=sys.stderr)
except UnicodeEncodeError: except UnicodeEncodeError:
print >>sys.stderr, msg2.encode('utf-8') print(msg2.encode('utf-8'), file=sys.stderr)
if C.DEFAULT_LOG_PATH != '': if C.DEFAULT_LOG_PATH != '':
while msg.startswith("\n"): while msg.startswith("\n"):
msg = msg.replace("\n","") msg = msg.replace("\n","")

Loading…
Cancel
Save