From ee380d4575bd7b5d2a7ade2ecf162043d34263db Mon Sep 17 00:00:00 2001 From: bill Date: Tue, 12 May 2015 17:57:55 -0700 Subject: Fix s3cmd output processing Fix typo preventing s3cmd output from being processed. Add formatting support for s3cmd errors. --- bin/user/S3upload.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/user/S3upload.py b/bin/user/S3upload.py index 921c94c..3002c44 100644 --- a/bin/user/S3upload.py +++ b/bin/user/S3upload.py @@ -82,7 +82,7 @@ class S3uploadGenerator(weewx.reportengine.ReportGenerator): try: S3upload_cmd = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - stdout = s3upload_cmd.communicate()[0] + stdout = S3upload_cmd.communicate()[0] stroutput = stdout.strip() except OSError, e: if e.errno == errno.ENOENT: @@ -118,7 +118,9 @@ class S3uploadGenerator(weewx.reportengine.ReportGenerator): S3upload_message = "executed in %0.2f seconds" else: # suspect we have an s3cmd error so display a message - syslog.syslog(syslog.LOG_INFO, "S3upload: s3cmd reported errors: %s" % stroutput) + syslog.syslog(syslog.LOG_INFO, "S3upload: s3cmd reported errors") + for line in iter(stroutput.splitlines()): + syslog.syslog(syslog.LOG_INFO, "S3upload: s3cmd error: %s" % line) S3upload_message = "executed in %0.2f seconds" stop_ts = time.time() -- cgit v1.2.3