diff --git a/README.rst b/README.rst index 0e43d00..65f52f9 100644 --- a/README.rst +++ b/README.rst @@ -39,6 +39,11 @@ License Changelog ~~~~~~~~~ +- v0.7.5 + + - Fix an issue where dictionary attributes (like ``jtEnvironment``) could + encounter ``UnicodeDecodeError``s upon assignment. + - v0.7.4 - Switch to using preferred encoding from ``locale`` module for converting diff --git a/drmaa/helpers.py b/drmaa/helpers.py index 2fdeb52..8212e8f 100644 --- a/drmaa/helpers.py +++ b/drmaa/helpers.py @@ -200,8 +200,13 @@ def __init__(self, name): self.name = name def __set__(self, instance, value): - v = ["{0}={1}".format(k, v).encode(ENCODING) for (k, v) in - value.items()] + v = [] + for k, v in value.items(): + if isinstance(k, bytes): + k = k.decode(ENCODING) + if isinstance(v, bytes): + v = v.decode(ENCODING) + v.append("{0}={1}".format(k, v).encode(ENCODING)) c(drmaa_set_vector_attribute, instance, self.name, string_vector(v)) diff --git a/drmaa/version.py b/drmaa/version.py index fd8c1f4..5ba4a2b 100644 --- a/drmaa/version.py +++ b/drmaa/version.py @@ -22,5 +22,5 @@ :author: Dan Blanchard (dblanchard@ets.org) ''' -__version__ = '0.7.4' +__version__ = '0.7.5' VERSION = tuple(int(x) for x in __version__.split('.')) diff --git a/test/testwrap.py b/test/testwrap.py index f0972b5..6ad4f5e 100644 --- a/test/testwrap.py +++ b/test/testwrap.py @@ -61,7 +61,7 @@ class SubmitBase(unittest.TestCase): def setUp(self): self.jt = jt = Session.createJobTemplate() jt.remoteCommand = 'python' - jt.args = ['-c', "print 'hello from python!'"] + jt.args = ['-c', "print('hello from python!')"] if hasattr(self, 'jt_tweaks'): self.jt_tweaks() self.jid = Session.runJob(jt)