0

I am just making a simple sign in agent that creates an account and locks it using the gnupg module. Unfortunately, I get this error TypeError: a bytes-like object is required, not 'str. I have tried all sorts of different ways to convert my password into bytes but nothing seems to work.

Here is the line that is breaking

        private_export = self.gpg.export_keys(key, secret=True, passphrase=self.password)

Help would be appreciated!

Spartan
  • 3
  • 3

1 Answers1

1

Did you try with any of this??:

pass_in_bytes = bytes(self.password, 'utf-8')
or
pass_in_bytes = self.password.encode('utf-8')
or
pass_in_bytes = str.encode(self.password)

Always ensure if it's byte representation. I'm not sure if the "key" param or the "passphrase" param must be the byte.

ljuk
  • 701
  • 3
  • 12
  • Yes I did. I figured out this module has some errors in it, so I am going to use something else. Thanks for the help though. – Spartan Nov 28 '20 at 05:03