I'm running a command that outputs some metadata that has invalid UTF-8 in it. The command would finish if I was able to surpress the population of stderr. Is there a way to either call .encode('utf-8','ignore').decode('utf-8') so this exception doesn't stop everything in its tracks?
shpyx/runner.py:131, in Runner._add_stderr(self, result, data, log_output)
128 if not data:
129 return
--> 131 result.stderr += data.decode()
132 result.all_output += data.decode()
134 if _is_action_required(user=log_output, default=self._log_output):
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 637-638: invalid continuation byte
Another option might be to add a no_stderr flag to run so this section of code could be skipped over if needs be.
My workaround atm is:
result.stderr += data.decode('utf-8', 'ignore')
result.all_output += data.decode('utf-8', 'ignore')
The above isn't a great default but maybe if parameters that allowed for the above override to be passed in could at least allow those calling run to work around misbehaving commands.
I'm running a command that outputs some metadata that has invalid UTF-8 in it. The command would finish if I was able to surpress the population of stderr. Is there a way to either call
.encode('utf-8','ignore').decode('utf-8')so this exception doesn't stop everything in its tracks?Another option might be to add a
no_stderrflag torunso this section of code could be skipped over if needs be.My workaround atm is:
The above isn't a great default but maybe if parameters that allowed for the above override to be passed in could at least allow those calling run to work around misbehaving commands.