Grab_jpeg throwing broken data stream error
A scan was working well at 2MP until broken data stream when reading image file
Click to expand
23/06/2025 16:20:03: ERRORThe scan stopped because of an error: broken data stream when reading image file Attempting to stitch and archive the images acquired so far.
The scan stopped because of an error: broken data stream when reading image file Attempting to stitch and archive the images acquired so far.
Traceback (most recent call last): File "/var/openflexure/application/openflexure-microscope-server/src/openflexure_microscope_server/things/smart_scan.py", line 551, in _run_scan self._main_scan_loop()
File "/var/openflexure/application/openflexure-microscope-server/src/openflexure_microscope_server/things/smart_scan.py", line 109, in scan_running_wrapper return method(self, *args, **kwargs)
File "/var/openflexure/application/openflexure-microscope-server/src/openflexure_microscope_server/things/smart_scan.py", line 641, in _main_scan_loop capture_image = self._background_detect.image_is_sample()
File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/labthings_fastapi/client/in_server.py", line 105, in action_method return getattr(self._wrapped_thing, name)(**kwargs_and_deps)
File "/var/openflexure/application/openflexure-microscope-server/src/openflexure_microscope_server/things/background_detect.py", line 95, in image_is_sample b_fraction = self.background_fraction(cam)
File "/var/openflexure/application/openflexure-microscope-server/src/openflexure_microscope_server/things/background_detect.py", line 85, in background_fraction current_image = np.array(Image.open(current_image.open()))
File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/PIL/Image.py", line 742, in array_interface new["data"] = self.tobytes()
File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/PIL/Image.py", line 802, in tobytes self.load()
File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/PIL/ImageFile.py", line 312, in load raise _get_oserror(err_code, encoder=False)
OSError: broken data stream when reading image file
An issue with grab_jpeg. Branch was jpeg-capture-in-stacking
Note that this so far has happened exactly once during testing and it has been seen again during scanning (see #500 (closed)).