use chr function or struct module (docs.python.org/library/struct.html)
pyTony
pyMod
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
You should provide more information and example data. If you are working in python 3, a way to write a raw integer is f.write(bytearray((n,)). Otherwise what are the types of the values prependByte, fileLength, pngChunk, etc ?
Gribouillis
Posting Maven
2,786 posts since Jul 2008
Reputation Points: 1,044
Solved Threads: 691
but when the chunk is inserted, each item gets a "\n"
Python does not write a "\n" to a file as it does with a print statement. If there is a "\n" it must be in the string, so print the string so you know what is being added. Also, ImageMagick will append two PNG files so use it if you can as it is tested.
woooee
Nearly a Posting Maven
2,454 posts since Dec 2006
Reputation Points: 777
Solved Threads: 714