OD calibration crash due to unexpected end of data

Hi everyone,

Now and then, I mistype a letter such as “ø” during the OD calibration of the Pioreactors and this causes the entire calibration process to crash and get terminated! For instance, I was calibrating for OD and I have completed measuring 15 out of 28 measurements before accidentally typing the “ø” instead of “y” to take measurements (and just to be clear, I deleted the “ø” and typed “y” before I press enter, however, since I typed it once, it was enough that I typed “ø” before to cause the crash for some reason). This caused the calibration to crash, and I do not know if it can be recovered, but I think it is a nice idea to change this setup to avoid any potential crash caused by unexpected typing error which might occur due to similar cases.

In case it is helpful, this is the error code generated after the crash:

Traceback (most recent call last):
  File "/usr/local/bin/pio", line 8, in <module>
    sys.exit(pio())
             ^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1666, in invoke
    rv = super().invoke(ctx)
         ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/pioreactor/actions/od_calibration.py", line 738, in click_od_calibration
    od_calibration(json_file)
  File "/usr/local/lib/python3.11/dist-packages/pioreactor/actions/od_calibration.py", line 534, in od_calibration
    inferred_od600s, voltages = start_recording_and_diluting(
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/pioreactor/actions/od_calibration.py", line 299, in start_recording_and_diluting
    while not confirm(green("Continue?"), default=False):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/termui.py", line 233, in confirm
    value = visible_prompt_func(" ").lower().strip()
            ^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 1: unexpected end of data
1 Like

Yes, we should protect against this! Thanks for the suggestion and showing the stack-trace, we’ll fix for the next release.

1 Like