convert print statements to py3
This commit is contained in:
parent
2aa4392a38
commit
632ba9acfe
15 changed files with 54 additions and 40 deletions
|
@ -1,3 +1,4 @@
|
|||
from __future__ import print_function
|
||||
import ConfigParser
|
||||
|
||||
def read_config_file(config_path):
|
||||
|
@ -6,10 +7,10 @@ def read_config_file(config_path):
|
|||
try:
|
||||
config.readfp(open(config_path))
|
||||
except IOError as e:
|
||||
print "Failed to open config file at " + config_path + ": " + e.strerror
|
||||
print("Failed to open config file at {}: {}".format(config_path, e.strerror))
|
||||
exit(-1)
|
||||
except Exception as e:
|
||||
print e.strerror
|
||||
print(e.strerror)
|
||||
exit(-1)
|
||||
|
||||
return config
|
||||
return config
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"""Runs the airtime_analyzer application.
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import daemon
|
||||
import argparse
|
||||
import os
|
||||
|
@ -14,7 +15,7 @@ DEFAULT_HTTP_RETRY_PATH = '/tmp/airtime_analyzer_http_retries'
|
|||
|
||||
def run():
|
||||
'''Entry-point for this application'''
|
||||
print "Airtime Analyzer " + VERSION
|
||||
print("Airtime Analyzer {}".format(VERSION))
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-d", "--daemon", help="run as a daemon", action="store_true")
|
||||
parser.add_argument("--debug", help="log full debugging output", action="store_true")
|
||||
|
@ -57,8 +58,8 @@ def check_if_media_monitor_is_running():
|
|||
try:
|
||||
process_name = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read()
|
||||
if 'media_monitor.py' in process_name:
|
||||
print "Error: This process conflicts with media_monitor, and media_monitor is running."
|
||||
print " Please terminate the running media_monitor.py process and try again."
|
||||
print("Error: This process conflicts with media_monitor, and media_monitor is running.")
|
||||
print(" Please terminate the running media_monitor.py process and try again.")
|
||||
exit(1)
|
||||
except IOError: # proc has already terminated
|
||||
continue
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import print_function
|
||||
from setuptools import setup
|
||||
from subprocess import call
|
||||
import sys
|
||||
|
@ -5,7 +6,7 @@ import os
|
|||
|
||||
# Change directory since setuptools uses relative paths
|
||||
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 airtime_analyzer
|
||||
|
@ -16,7 +17,7 @@ if '--no-init-script' in sys.argv:
|
|||
else:
|
||||
data_files = [('/etc/init', ['install/upstart/airtime_analyzer.conf']),
|
||||
('/etc/init.d', ['install/sysvinit/airtime_analyzer'])]
|
||||
print data_files
|
||||
print(data_files)
|
||||
|
||||
setup(name='airtime_analyzer',
|
||||
version='0.1',
|
||||
|
@ -49,8 +50,8 @@ setup(name='airtime_analyzer',
|
|||
|
||||
# Remind users to reload the initctl config so that "service start airtime_analyzer" works
|
||||
if data_files:
|
||||
print "Remember to reload the initctl configuration"
|
||||
print "Run \"sudo initctl reload-configuration; sudo service airtime_analyzer restart\" now."
|
||||
print "Or on Ubuntu Xenial (16.04)"
|
||||
print "Remember to reload the systemd configuration"
|
||||
print "Run \"sudo systemctl daemon-reload; sudo service airtime_analyzer restart\" now."
|
||||
print("Remember to reload the initctl configuration")
|
||||
print("Run \"sudo initctl reload-configuration; sudo service airtime_analyzer restart\" now.")
|
||||
print("Or on Ubuntu Xenial (16.04)")
|
||||
print("Remember to reload the systemd configuration")
|
||||
print("Run \"sudo systemctl daemon-reload; sudo service airtime_analyzer restart\" now.")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import print_function
|
||||
import datetime
|
||||
import mutagen
|
||||
import mock
|
||||
|
@ -79,8 +80,8 @@ def test_ogg_stereo():
|
|||
''' faac and avconv can't seem to create a proper mono AAC file... ugh
|
||||
def test_aac_mono():
|
||||
metadata = MetadataAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-mono.m4a')
|
||||
print "Mono AAC metadata:"
|
||||
print metadata
|
||||
print("Mono AAC metadata:")
|
||||
print(metadata)
|
||||
check_default_metadata(metadata)
|
||||
assert metadata['channels'] == 1
|
||||
assert metadata['bit_rate'] == 80000
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import print_function
|
||||
from nose.tools import *
|
||||
from airtime_analyzer.replaygain_analyzer import ReplayGainAnalyzer
|
||||
|
||||
|
@ -28,7 +29,7 @@ def check_default_metadata(metadata):
|
|||
'''
|
||||
tolerance = 0.30
|
||||
expected_replaygain = 5.0
|
||||
print metadata['replay_gain']
|
||||
print(metadata['replay_gain'])
|
||||
assert abs(metadata['replay_gain'] - expected_replaygain) < tolerance
|
||||
|
||||
def test_missing_replaygain():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue