Replace file with open, which is Python 3 compatible

Change-Id: I471ae9b372f88a508d4654b1a18c6da90397a828
Python 3: do not use the unicode() function

It is Python2-specific, and should not be used in code intended to be portable.

Change-Id: Ibebef1a7e51a7444538275d22d444c926b8b4dec
Closes-Bug: 1284677
Merge "Replace file with open, which is Python 3 compatible"
Merge "Python 3: do not use the unicode() function"