I have a Python (v2.7) script that uses the Bitbucket-api package to create an archive of a project boilerplate in Bitbucket and extract that to create a new project from that boilerplate code.
Almost everything is working great, but any images in that boilerplate are corrupted when extracted to create the new project's code base. I'm new to Python, so I'm hoping someone can give me a hand with this. I believe that the corruption is getting introduced in this line, but that's just a semi-educated guess.
If I print the file content before writing it, it looks something like this:
�PNG
IHDRo��yIDAT(�c8s�Q0
�
p�M\�KIEND�B`�
So...binary. The current .write(content.encode('utf-8')) doesn't seem to work for binary content.
What do I need to do to write that content to a file without corrupting it?