SyntaxError: invalid syntax

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:

[CODE]
get/product/jfltetmo/userdata.img
File “./build/tools/releasetools/build_image.py”, line 157
print cmd
^
SyntaxError: invalid syntax
[/CODE]

The fix was actually quite easy. I needed to encapsulate the cmd in parenthesis, like this:

./build/tools/releasetools/build_image.py

[CODE]
cmd = “fec -e -p %d %s %s %s” % (padding_size, sparse_image_path,
verity_path, verity_fec_path)
print (cmd) # WJH
status, output = commands.getstatusoutput(cmd)
[/CODE]

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s