Tweaks

For Piaware SD Card image, there are two alternate scripts (the first and last) . Which one you used and faced problem?

To find where is the problem, I replicate your issue as follows:
(1) Downloaded “piaware-sd-card-3.5.0.img.zip” and unzipped it.
(2) Formatted microSD card, and wrote “piaware-sd-card-3.5.0.img” to it.

TEST-1

  • Downloaded following file:
    The First one in the list
    Optimize-Gain-Piaware-SD-Card-Image.docx

  • Created file optimize-gain.py and copy-pasted from downloaded .docx file

  • Made the file executable and then ran the file. It worked perfectly well without any error.

TEST-2