def read_as_utf8(fileno):
    fp = io.open(fileno, mode='r', encoding='utf-8', closefd=False)
print(fp.read())
fp.close()
gpg = subprocess.Popen(['gpg', '--version'], stdout=subprocess.PIPE)
Wrap an open stream with io.TextIOWrapper