mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-27 19:17:06 +08:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user