From a95868307123fa0a8e7c8d4f464ddf8d1e8693e0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 27 Apr 2023 18:17:11 +0200 Subject: [PATCH] Make png2c.py work with Python 3.9+ array.tostring() was removed in 3.9, so use tobytes() instead. This makes the script incompatible with Python 2, but this shouldn't be much of a concern any more these days. --- misc/scripts/png2c.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/scripts/png2c.py b/misc/scripts/png2c.py index aedb81e13f..8d527f04b4 100755 --- a/misc/scripts/png2c.py +++ b/misc/scripts/png2c.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # This script is a slightly modified version of the original found at # @@ -50,7 +50,7 @@ for path in sys.argv[1:]: # Each PNG file starts with a 8 byte signature that should be followed # by IHDR chunk which is always 13 bytes in length so the first 16 # bytes are fixed (or at least we expect them to be). - if bytes[0:16].tostring() != b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR': + if bytes[0:16].tobytes() != b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR': print('"%s" doesn\'t seem to be a valid PNG file.' % filename) continue