isislovecruft / python-gnupg

A modified version of python-gnupg, including security patches, extensive documentation, and extra features.
Other
426 stars 171 forks source link

Unknown status message: 'KEY_CONSIDERED' for _handle_status #247

Closed JPiao closed 5 years ago

JPiao commented 5 years ago

When trying to export private key:

gpg.export_keys(key, True)

I get the following:

File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/gnupg/_parsers.py", line 1351, in _handle_status
    raise ValueError("Unknown status message: %r" % key)
ValueError: Unknown status message: 'KEY_CONSIDERED'

It seems like _handle_status isn't handling the case of of KEY_CONSIDERED.

def _handle_status(self, key, value):
        """Parse a status code from the attached GnuPG process.

        :raises ValueError: if the status message is unknown.
        """
        if key in ("EXPORTED"):
            self.fingerprints.append(value)
        elif key == "EXPORT_RES":
            export_res = value.split()
            for x in self.counts.keys():
                self.counts[x] += int(export_res.pop(0))
        else:
            raise ValueError("Unknown status message: %r" % key)

As a quick fix, I was going to add a case for this, but not sure what the logic should be if it was KEY_CONSIDERED.

Thanks

pope843 commented 6 months ago

@JPiao im having the same error, what was fix here?