fix open() calls for python3
Merge remote-tracking branch 'arskom/master'