Commit 5a750777 authored by Vincent Michel's avatar Vincent Michel Committed by Sebastien Petitdemange
Browse files

Python 3 migration - Fix str/bytes issues in flint modules

parent d0d1794d
......@@ -191,6 +191,7 @@ def check_flint(session_name):
for key in redis.scan_iter(
"flint:%s:%s:*" % (platform.node(), os.environ.get("USER"))
):
key = key.decode()
pid = int(key.split(":")[-1])
if psutil.pid_exists(pid):
value = redis.lindex(key, 0).split()[0]
......@@ -218,7 +219,7 @@ def attach_flint(pid):
# Current URL
key = "flint:{}:{}:{}".format(platform.node(), os.environ.get("USER"), pid)
value = redis.brpoplpush(key, key, timeout=3000)
url = value.split()[-1]
url = value.decode().split()[-1]
# Return flint proxy
proxy = zerorpc.Client(url)
......
......@@ -50,10 +50,8 @@ class QtExecutor(qt.QObject):
return
try:
result = fn(*args, **kwargs)
except BaseException:
# Forward the traceback
_, exc, tb = sys.exc_info()
future.set_exception_info(exc, tb)
except BaseException as exc:
future.set_exception(exc)
else:
future.set_result(result)
......
......@@ -253,7 +253,7 @@ class Flint:
beacon = get_default_connection()
redis = beacon.get_redis_connection()
key = get_flint_key()
current_value = redis.lindex(key, 0)
current_value = redis.lindex(key, 0).decode()
value = session_name + " " + current_value.split()[-1]
redis.lpush(key, value)
redis.rpop(key)
......
......@@ -89,7 +89,12 @@ class LivePlot1D(qt.QWidget):
def set_y_axes(self, axis_names_list):
self.y_axis_names = axis_names_list
plot_selected = self.redis_cnx.hgetall("%s:plot_select" % self._session_name)
raw_plot_selected = self.redis_cnx.hgetall(
"%s:plot_select" % self._session_name
)
plot_selected = {
key.decode(): value.decode() for key, value in raw_plot_selected.items()
}
self.silx_plot.clearCurves()
for x_row in range(self.axes_list_model.rowCount()):
x_item = self.axes_list_model.item(x_row, 1)
......@@ -377,9 +382,12 @@ class LiveScatterPlot(qt.QWidget):
self.axes_list_model.appendRow([item_name, item_select_x, item_select_y])
def set_z_axes(self, axis_names_list):
scatter_selected = self.redis_cnx.hgetall(
raw_scatter_selected = self.redis_cnx.hgetall(
"%s:scatter_select" % self._session_name
)
scatter_selected = {
key.decode(): value.decode() for key, value in raw_scatter_selected.items()
}
already_select_one = False
for axis_name in sorted(axis_names_list):
item_name = qt.QStandardItem(axis_name)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment