@@ -66,7 +66,7 @@ def write_pec_header(pattern, f, threadlist):
6666 ), "too many color changes, ({0}) out of bounds (0, 255)" .format (
6767 len (color_index_list )
6868 )
69- f .write (bytes (color_index_list ))
69+ f .write (bytes (bytearray ( color_index_list ) ))
7070 else :
7171 f .write (b"\x20 \x20 \x20 \x20 \x64 \x20 \x00 \x20 \x00 \x20 \x20 \x20 \xFF " )
7272
@@ -102,13 +102,13 @@ def write_pec_graphics(pattern, f, extends):
102102 for block in pattern .get_as_stitchblock ():
103103 stitches = block [0 ]
104104 draw_scaled (extends , stitches , blank , 6 , 4 )
105- f .write (bytes (blank ))
105+ f .write (bytes (bytearray ( blank ) ))
106106
107107 for block in pattern .get_as_colorblocks ():
108108 stitches = [s for s in block [0 ] if s [2 ] == STITCH ]
109109 blank = get_blank () # [ 0 ] * 6 * 38
110110 draw_scaled (extends , stitches , blank , 6 )
111- f .write (bytes (blank ))
111+ f .write (bytes (bytearray ( blank ) ))
112112
113113
114114def write_value (f , value , long = False , flag = 0 ):
@@ -121,7 +121,7 @@ def write_value(f, value, long=False, flag=0):
121121 value |= flag << 8
122122 data .append ((value >> 8 ) & 0xFF )
123123 data .append (value & 0xFF )
124- f .write (bytes (data ))
124+ f .write (bytes (bytearray ( data ) ))
125125
126126
127127def write_trimjump (f , dx , dy ):
0 commit comments