Commit 9dea77e9 authored by bliss administrator's avatar bliss administrator

[wip] fixing to python3

parent 4023c4b2
......@@ -196,7 +196,7 @@ class PI_HEXA(Controller):
def _check_error_and_raise(self, ignore_stop=False, **kwargs):
err = int(self.command("ERR?", **kwargs))
if err > 0:
if ignore_stop and err == 10: # stopped by user
if ignore_stop and err == 2: # stopped by user
return
human_error = get_error_str(err)
errors = [self.name, err, human_error]
......
......@@ -417,6 +417,10 @@ class musst(object):
with remote_open(program_file) as program:
program_bytes = program.read()
for old, new in template_replacement.items():
if isinstance(old, str):
old = old.encode()
if isinstance(new, str):
new = new.encode()
program_bytes = program_bytes.replace(old, new)
self.upload_program(program_bytes)
......@@ -426,7 +430,8 @@ class musst(object):
program_data -- program data you want to upload
"""
program_data = program_data.encode()
if isinstance(program_data, str):
program_data = program_data.encode()
m = hashlib.md5()
m.update(program_data)
md5sum = m.hexdigest()
......@@ -473,14 +478,14 @@ class musst(object):
current_offset = current_buffer_id * buffer_size + current_offset
from_offset = (from_event_id * nb_counters) % buffer_memory
current_offset = current_offset / nb_counters * nb_counters
current_offset = current_offset // nb_counters * nb_counters
if current_offset >= from_offset:
nb_lines = (current_offset - from_offset) / nb_counters
nb_lines = (current_offset - from_offset) // nb_counters
data = numpy.empty((nb_lines, nb_counters), dtype=numpy.int32)
self._read_data(from_offset, current_offset, data)
else:
nb_lines = current_offset / nb_counters
first_nblines = (buffer_memory - from_offset) / nb_counters
nb_lines = current_offset // nb_counters
first_nblines = (buffer_memory - from_offset) // nb_counters
nb_lines += first_nblines
data = numpy.empty((nb_lines, nb_counters), dtype=numpy.int32)
self._read_data(from_offset, buffer_memory, data)
......
Markdown is supported
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