def decrypt(filename): with open(log_dir + filename, 'rb') as f: status = gpg.decrypt_file(f, output=log_dir + filename + '-decrypted') print('ok: ', status.ok) print('status: ', status.status) print('stderr: ', status.stderr) if status.ok: return True else: return False