diff --git a/pavelib/docs.py b/pavelib/docs.py index bf8a61d099..a6901fefe9 100644 --- a/pavelib/docs.py +++ b/pavelib/docs.py @@ -1,3 +1,4 @@ +from __future__ import print_function import sys from paver.easy import * @@ -31,13 +32,21 @@ def doc_path(options, allow_default=True): path = DOC_PATHS.get(doc_type) if doc_type == 'default' and not allow_default: - print "You must specify a documentation type using '--type'. Valid options are: {options}".format( - options=valid_doc_types()) + print( + "You must specify a documentation type using '--type'. " + "Valid options are: {options}".format( + options=valid_doc_types() + ) + ) sys.exit(1) if path is None: - print "Invalid documentation type '{doc_type}'. Valid options are: {options}".format( - doc_type=doc_type, options=valid_doc_types()) + print( + "Invalid documentation type '{doc_type}'. " + "Valid options are: {options}".format( + doc_type=doc_type, options=valid_doc_types() + ) + ) sys.exit(1) else: diff --git a/pavelib/prereqs.py b/pavelib/prereqs.py index 25db06ba94..8f5cf1205b 100644 --- a/pavelib/prereqs.py +++ b/pavelib/prereqs.py @@ -89,7 +89,7 @@ def prereq_cache(cache_name, paths, install_func): cache_file.write(new_hash) else: - print '{cache} unchanged, skipping...'.format(cache=cache_name) + print('{cache} unchanged, skipping...'.format(cache=cache_name)) def install_ruby_prereqs(): diff --git a/pavelib/servers.py b/pavelib/servers.py index e4a61a88b8..e1075d2014 100644 --- a/pavelib/servers.py +++ b/pavelib/servers.py @@ -1,7 +1,8 @@ """ Run and manage servers for local development. """ - +from __future__ import print_function +import sys import argparse from paver.easy import * from .utils.cmd import django_cmd @@ -21,7 +22,7 @@ def run_server(system, settings=None, port=None, skip_assets=False): If `skip_assets` is True, skip the asset compilation step. """ if system not in ['lms', 'studio']: - print "System must be either lms or studio" + print("System must be either lms or studio", file=sys.stderr) exit(1) if not skip_assets: diff --git a/pavelib/utils/envs.py b/pavelib/utils/envs.py index 798cb3c460..756fc4216f 100644 --- a/pavelib/utils/envs.py +++ b/pavelib/utils/envs.py @@ -1,6 +1,7 @@ """ Helper functions for loading environment settings. """ +from __future__ import print_function import os import sys import json @@ -34,7 +35,11 @@ class Env(object): # If the file does not exist, issue a warning and return an empty dict if not os.path.isfile(env_path): - print "Warning: could not find environment JSON file at '{path}'".format(path=env_path) + print( + "Warning: could not find environment JSON file " + "at '{path}'".format(path=env_path), + file=sys.stderr, + ) return dict() # Otherwise, load the file as JSON and return the resulting dict @@ -43,7 +48,11 @@ class Env(object): return json.load(env_file) except ValueError: - print "Error: Could not parse JSON in {path}".format(path=env_path) + print( + "Error: Could not parse JSON " + "in {path}".format(path=env_path), + file=sys.stderr, + ) sys.exit(1) @lazy diff --git a/pavelib/utils/process.py b/pavelib/utils/process.py index aede7ceabc..1b3a504599 100644 --- a/pavelib/utils/process.py +++ b/pavelib/utils/process.py @@ -1,7 +1,7 @@ """ Helper functions for managing processes. """ - +from __future__ import print_function import sys import os import subprocess