This is because some bytes-like objects (such as memoryview) don't
have a "decode()" method. It appears that the preferred way to get a
decoded string is to simply call the constructor with the bytes-like
object and the desired encoding.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>
def determine_image_id(dockerImageId):
for line in (
- subprocess.check_output( # nosec
- ["docker", "images", "--no-trunc", "--all"]
- )
- .decode("utf-8")
- .splitlines()
+ str(subprocess.check_output( # nosec
+ ["docker", "images", "--no-trunc", "--all"]
+ ), "utf-8")
+ .splitlines()
):
try:
match = re.match(r"^([^ ]+)\s+([^ ]+)\s+([^ ]+)", line)
text = tool.doc_loader.fetch_text(w)
if isinstance(text, bytes):
- textIO = StringIO(text.decode('utf-8'))
+ textIO = StringIO(str(text, 'utf-8'))
else:
textIO = StringIO(text)
if "cwl.output.json" in outc:
with outc.open("cwl.output.json", "rb") as f:
if f.size() > 0:
- outputs = json.loads(f.read().decode())
+ outputs = json.loads(str(f.read(), 'utf-8'))
def keepify(fileobj):
path = fileobj["location"]
if not path.startswith("keep:"):