convert print statements to py3

This commit is contained in:
Kyle Robbertze 2020-01-16 15:33:44 +02:00
parent 2aa4392a38
commit 632ba9acfe
15 changed files with 54 additions and 40 deletions

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import traceback
"""
@ -133,21 +134,20 @@ class Notify:
elif options.liquidsoap_started:
self.notify_liquidsoap_started()
else:
logger.debug("Unrecognized option in options(%s). Doing nothing" \
% str(options))
logger.debug("Unrecognized option in options({}). Doing nothing".format(options))
if __name__ == '__main__':
print
print '#########################################'
print '# *** pypo *** #'
print '# pypo notification gateway #'
print '#########################################'
print()
print('#########################################')
print('# *** pypo *** #')
print('# pypo notification gateway #')
print('#########################################')
# initialize
try:
n = Notify()
n.run_with_options(options)
except Exception as e:
print( traceback.format_exc() )
print(traceback.format_exc())

View file

@ -1,6 +1,7 @@
""" Runs Airtime liquidsoap
"""
from __future__ import print_function
import argparse
import os
import generate_liquidsoap_cfg
@ -11,7 +12,7 @@ PYPO_HOME = '/var/tmp/airtime/pypo/'
def run():
'''Entry-point for this application'''
print "Airtime Liquidsoap"
print("Airtime Liquidsoap")
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--debug", help="run in debug mode", action="store_true")
args = parser.parse_args()

View file

@ -1,3 +1,4 @@
from __future__ import print_function
import logging
import os
import sys
@ -49,7 +50,7 @@ def run():
generate_liquidsoap_config(ss)
successful = True
except Exception, e:
print "Unable to connect to the Airtime server."
print("Unable to connect to the Airtime server.")
logging.error(str(e))
logging.error("traceback: %s", traceback.format_exc())
if attempts == max_attempts:

View file

@ -1,3 +1,4 @@
from __future__ import print_function
from api_clients import *
import sys
@ -16,8 +17,8 @@ elif dj_type == '--dj':
response = api_clients.check_live_stream_auth(username, password, source_type)
if 'msg' in response and response['msg'] == True:
print response['msg']
print(response['msg'])
sys.exit(0)
else:
print False
print(False)
sys.exit(1)

View file

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
import logging
import json
import time
@ -36,7 +37,7 @@ def api_client(logger):
try:
config = ConfigObj('/etc/airtime/airtime.conf')
except Exception, e:
print ('Error loading config file: %s', e)
print('Error loading config file: %s', e)
sys.exit()
# TODO : add docstrings everywhere in this module

View file

@ -1,3 +1,4 @@
from __future__ import print_function
import telnetlib
from timeout import ls_timeout
@ -302,7 +303,7 @@ class DummyTelnetLiquidsoap:
self.logger.info("Pushing %s to queue %s" % (media_item, queue_id))
from datetime import datetime
print "Time now: %s" % datetime.utcnow()
print("Time now: {:s}".format(datetime.utcnow()))
annotation = create_liquidsoap_annotation(media_item)
self.liquidsoap_mock_queues[queue_id].append(annotation)
@ -318,7 +319,7 @@ class DummyTelnetLiquidsoap:
self.logger.info("Purging queue %s" % queue_id)
from datetime import datetime
print "Time now: %s" % datetime.utcnow()
print("Time now: {:s}".format(datetime.utcnow()))
except Exception:
raise

View file

@ -1,3 +1,4 @@
from __future__ import print_function
from pypoliqqueue import PypoLiqQueue
from telnetliquidsoap import DummyTelnetLiquidsoap, TelnetLiquidsoap
@ -45,7 +46,7 @@ plq.daemon = True
plq.start()
print "Time now: %s" % datetime.utcnow()
print("Time now: {:s}".format(datetime.utcnow()))
media_schedule = {}

View file

@ -1,10 +1,11 @@
from __future__ import print_function
from setuptools import setup
from subprocess import call
import sys
import os
script_path = os.path.dirname(os.path.realpath(__file__))
print script_path
print(script_path)
os.chdir(script_path)
# Allows us to avoid installing the upstart init script when deploying on Airtime Pro:
@ -29,7 +30,7 @@ else:
('/var/tmp/airtime/pypo/files', []),
('/var/tmp/airtime/pypo/tmp', []),
]
print data_files
print(data_files)
setup(name='airtime-playout',
version='1.0',
@ -67,6 +68,6 @@ setup(name='airtime-playout',
# Reload the initctl config so that playout services works
if data_files:
print "Reloading initctl configuration"
print("Reloading initctl configuration")
#call(['initctl', 'reload-configuration'])
print "Run \"sudo service airtime-playout start\" and \"sudo service airtime-liquidsoap start\""
print("Run \"sudo service airtime-playout start\" and \"sudo service airtime-liquidsoap start\"")