As I was wrapping up my work on the upgrade to 7.1.2 on the S4, I ran into this error, which prevented the compiler from building the userdata.img file. Here’s the output:
File “./build/tools/releasetools/build_image.py”, line 157
SyntaxError: invalid syntax
The fix was actually quite easy. I needed to encapsulate the cmd in parenthesis, like this:
cmd = “fec -e -p %d %s %s %s” % (padding_size, sparse_image_path,
print (cmd) # WJH
status, output = commands.getstatusoutput(cmd)
The proof is in the pudding, but what help was how the cmd is defined, then notice that the “status, output” line also puts cmd in parenthesis. So, I did the same for the print cmd line, and it worked!
Linux – keep it simple.