From 82d85aeb398932a1e04dc87ea0bbb58af198c756 Mon Sep 17 00:00:00 2001 From: "kjellander@webrtc.org" Date: Wed, 18 Apr 2012 09:47:39 +0000 Subject: [PATCH] All errors are now printed to stderr instead of stdout. This will make them easier to detect when running as a cron job. BUG=None TEST=None Review URL: https://webrtc-codereview.appspot.com/482005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2050 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../build_internal/scripts/clean_old_files.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/continuous_build/build_internal/scripts/clean_old_files.py b/tools/continuous_build/build_internal/scripts/clean_old_files.py index 3b26bb5132..2b2d4811cb 100755 --- a/tools/continuous_build/build_internal/scripts/clean_old_files.py +++ b/tools/continuous_build/build_internal/scripts/clean_old_files.py @@ -51,7 +51,8 @@ def delete_directory(directory): # This is normal, ignore it pass else: - print 'Could not remove directory %s: reason %s.' % (directory, exception) + print >> sys.stderr, ('Could not remove directory %s: reason %s.' % + (directory, exception)) return False @@ -59,8 +60,8 @@ def delete_file(file): try: os.remove(file) except OSError as exception: - print 'Unexpectedly failed to remove file %s: reason %s.' % (file, - exception) + print >> sys.stderr, ('Unexpectedly failed to remove file %s: reason %s.' % + (file, exception)) def log_removal(file_or_directory, time_stamp, verbose): @@ -119,13 +120,11 @@ def main(): action='store_false', dest='skip_dirs', default=True, help='number of days') - options, args = parser.parse_args() + options, unused_args = parser.parse_args() if not options.cleanup_path: - print 'You must specify base directory' - sys.exit(2) + sys.exit('You must specify base directory') if not options.num_days: - print 'You must specify number of days old' - sys.exit(2) + sys.exit('You must specify number of days old') if options.verbose: print 'Cleaning up everything in %s older than %s days' % (