The patch below seems to make things work for me.  I've only tested it
with the python3 side of things, so perhaps it breaks python2 (although
there seems to have been similar code in place nearby, so it's probably
OK).

Beware: I'm very new to python, so someone that knows what they're doing
needs to ensure that it's not doing something silly.

For instance, it seems wrong to have to go round tacking these decodes
onto every output instance, so I'd guess there's some way of making
output do the right thing by default.

Cheers, Phil.

Attachment: signature.asc
Description: PGP signature

diff --git a/jenkins_jobs/builder.py b/jenkins_jobs/builder.py
index 3e7a497..94d8e02 100644
--- a/jenkins_jobs/builder.py
+++ b/jenkins_jobs/builder.py
@@ -307,7 +307,7 @@ class Builder(object):
                     logger.info("Job name:  %s", job.name)
                     logger.debug("Writing XML to '{0}'".format(output))
                     try:
-                        output.write(job.output())
+                        output.write(job.output().decode('utf-8'))
                     except IOError as exc:
                         if exc.errno == errno.EPIPE:
                             # EPIPE could happen if piping output to something
@@ -329,7 +329,7 @@ class Builder(object):
                 self.cache.set(job.name, old_md5)
 
             if self.cache.has_changed(job.name, md5) or self.ignore_cache:
-                self.jenkins.update_job(job.name, job.output())
+                self.jenkins.update_job(job.name, job.output().decode('utf-8'))
                 updated_jobs += 1
                 self.cache.set(job.name, md5)
             else:
-- 
|)|  Philip Hands  [+44 (0)20 8530 9560]  HANDS.COM Ltd.
|-|  http://www.hands.com/    http://ftp.uk.debian.org/
|(|  Hugo-Klemm-Strasse 34,   21075 Hamburg,    GERMANY

Reply via email to