def encrypt(filename): print('Encrypting: ' + log_dir + filename) with open(log_dir + filename, 'rb') as f: status = gpg.encrypt_file(f, None, passphrase=phrase, symmetric='AES256', output=log_dir + filename + '.aes') print('ok: ', status.ok) print('status: ', status.status) print('stderr: ', status.stderr) if status.ok: return True else: return False