UnicodeDecodeError: 'charmap' codec can't decode byte X in Y position: character maps to (undefined)

How to resolve the UnicodeDecodeError in robot framework.when I’m trying to store the trace content in vriable by running the oc commands getting this error

It would help if you:

  • Show an actual piece of test case where the error happens,
  • At least say what libraries and keyword is having the error
  • The complete error message may have important details to help finding root cause

(remove any private/confidential info, and paste as text, not images)


Hi @HelioGuilherme66, thanks for your response!

I need to automate using robot framework for an post API request. After sending the request, i need to login to OpenShift Container Platform then to select the pods after that navigating to trace directory selecting the trace name. Till this step im able to chieve it.
After getting trace name, i need to copy the content of that trace file to validate it with expected status.
For that im using this command:
${tracecontent}= Run oc exec ${podname} – cat /path/to/trace/${tracename}

Error message: UnicodeDecodeError: ‘charmap’ codec can’t decode byte X in Y position: character maps to (undefined)