@@ -286,7 +286,7 @@ async def send_command(
286286 if raw_response .count (RES_TERM_CHAR ) >= num_res_fields :
287287 break
288288 logger .debug ("[plate reader] Command: %s, Response: %s" , command , raw_response )
289- response = raw_response .decode ("utf-8" ).strip ().split (RES_TERM_CHAR .decode ())
289+ response = raw_response .decode ("utf-8" , errors = "replace" ).strip ().split (RES_TERM_CHAR .decode ())
290290 response = [r .strip () for r in response if r .strip () != "" ]
291291 self ._parse_basic_errors (response , command )
292292 return response
@@ -313,7 +313,7 @@ def _parse_basic_errors(self, response: List[str], command: str) -> None:
313313 f"Command '{ command } ' failed with unparsable error: { response [0 ]} "
314314 )
315315
316- if "OK" not in response [ 0 ] :
316+ if not any ( "OK" in r for r in response ) :
317317 raise MolecularDevicesError (f"Command '{ command } ' failed with response: { response } " )
318318 if "warning" in response [0 ].lower ():
319319 logger .warning ("Warning for command '%s': %s" , command , response )
@@ -326,19 +326,29 @@ async def close(self, plate: Optional[Plate] = None) -> None:
326326
327327 async def get_status (self ) -> List [str ]:
328328 res = await self .send_command ("!STATUS" )
329- return res [1 ].split ()
329+ if len (res ) > 1 :
330+ return res [1 ].split ()
331+ raise ValueError (f"Could not parse status from response: { res } " )
330332
331- async def read_error_log (self ) -> str :
333+ async def read_error_log (self ) -> List [ str ] :
332334 res = await self .send_command ("!ERROR" )
333- return res [1 ]
335+ if len (res ) > 1 :
336+ return res [1 ].split ()
337+ raise ValueError (f"Could not parse error log from response: { res } " )
334338
335339 async def clear_error_log (self ) -> None :
336340 await self .send_command ("!CLEAR ERROR" )
337341
338342 async def get_temperature (self ) -> Tuple [float , float ]:
339343 res = await self .send_command ("!TEMP" )
340- parts = res [1 ].split ()
341- return (float (parts [1 ]), float (parts [0 ])) # current, set_point
344+ if len (res ) > 1 :
345+ parts = res [1 ].split ()
346+ else :
347+ parts = res [0 ].replace ("OK" , "" ).split ()
348+
349+ if len (parts ) >= 2 :
350+ return (float (parts [1 ]), float (parts [0 ])) # current, set_point
351+ raise ValueError (f"Could not parse temperature from response: { res } " )
342352
343353 async def set_temperature (self , temperature : float ) -> None :
344354 if not (0 <= temperature <= 45 ):
0 commit comments