Python3: do not use the 'file' type

It does not exist in Python 3, so we have to use a workaround.

Change-Id: Ib41b5d12102707004b354835265861710aaba568
Closes-Bug: 1287728
Merge "Python3: do not use the 'file' type"