From 5b2ffe433479368d711a63d985b926966940cad5 Mon Sep 17 00:00:00 2001 From: Sven Joachim Date: Wed, 30 Oct 2019 17:28:07 +0100 Subject: [PATCH] check_for_fat: Avoid comparing strings and bytes By default Subprocess.open() opens file objects in binary mode, so the "filesystem" variable is an array of bytes, and comparing it to a string always yields false. Fix that by explicitly opening the stream in text mode. --- grml2usb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grml2usb b/grml2usb index 3585976..eaeba08 100755 --- a/grml2usb +++ b/grml2usb @@ -790,7 +790,7 @@ def check_for_fat(partition): try: udev_info = subprocess.Popen(["/sbin/blkid", "-s", "TYPE", "-o", "value", partition], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) filesystem = udev_info.communicate()[0].rstrip() if filesystem != "vfat": -- 2.1.4