diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-08-18 16:00:33 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-08-18 16:00:33 +0200 |
commit | 8a85900a16a0cb561a098ea35a34d2904fb99af7 (patch) | |
tree | 3d7a1d72ba019980ee1778ccded4d56c7bbd3309 /dpd/src | |
parent | 948a20a914b960c408534acba042d645a2639fd9 (diff) | |
download | dabmod-8a85900a16a0cb561a098ea35a34d2904fb99af7.tar.gz dabmod-8a85900a16a0cb561a098ea35a34d2904fb99af7.tar.bz2 dabmod-8a85900a16a0cb561a098ea35a34d2904fb99af7.zip |
DPDCE: Make python3 compatible
Diffstat (limited to 'dpd/src')
-rw-r--r-- | dpd/src/Adapt.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/dpd/src/Adapt.py b/dpd/src/Adapt.py index fec6aa5..2658240 100644 --- a/dpd/src/Adapt.py +++ b/dpd/src/Adapt.py @@ -38,12 +38,12 @@ class Adapt: sock.connect("tcp://%s:%d" % (self.host, self.port)) sock.send(b"ping") - data = sock.recv_multipart() + data = [el.decode() for el in sock.recv_multipart()] if data != ['ok']: raise RuntimeError( - "Could not connect to server %s %d." % - (self.host, self.port)) + "Could not ping server at %s %d: %s" % + (self.host, self.port, data)) return sock @@ -70,7 +70,7 @@ class Adapt: sock.send(part.encode(), flags=f) - data = sock.recv_multipart() + data = [el.decode() for el in sock.recv_multipart()] logging.info("Received message: %s" % message) return data @@ -132,9 +132,9 @@ class Adapt: def _write_coef_file(self, coefs_complex): f = open(self.coef_path, 'w') - f.write("{}\n".format(len(coefs_complex)).encode()) + f.write("{}\n".format(len(coefs_complex))) for coef in coefs_complex: - f.write("{}\n{}\n".format(coef.real, coef.imag).encode()) + f.write("{}\n{}\n".format(coef.real, coef.imag)) f.close() def set_coefs(self, coefs_complex): |