fix fatfs_create_spiflash_image() feature (IDFGH-6383)

Open the files in binary mode, and remove the redundant encode
pull/8169/head
Levente Tamas 2021-12-30 00:22:13 +02:00
rodzic 5624dffc52
commit df2ae4689c
2 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -167,7 +167,7 @@ class FATFS:
normal_path = os.path.normpath(folder_relative_path)
split_path = normal_path.split(os.sep)
if os.path.isfile(real_path):
with open(real_path) as file:
with open(real_path, "rb") as file:
content = file.read()
file_name, extension = os.path.splitext(split_path[-1])
extension = extension[1:] # remove the dot from the extension

Wyświetl plik

@ -47,7 +47,7 @@ class File:
# we assume that the correct amount of clusters is allocated
current_cluster = self._first_cluster
for content_part in split_content_into_sectors(content, self.fatfs_state.sector_size):
content_as_list = content_part.encode()
content_as_list = content_part
if current_cluster is None:
raise FatalError('No free space left!')