From 1bdf0290abbcf1cd218d3c0f9a8fefa64e7fb7c0 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 24 Jul 2013 15:53:37 +0200 Subject: [PATCH] File and IO handling in Py3 is different than Py2 Instead of checking whether data isinstance of 'file', then we check that it is file-like _enough_ to be treated as a file (i.e. it hasattr 'read'). --- gnupg/gnupg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnupg/gnupg.py b/gnupg/gnupg.py index efa9b1f..21623dd 100644 --- a/gnupg/gnupg.py +++ b/gnupg/gnupg.py @@ -180,7 +180,7 @@ class GPG(GPGBase): else: log.warn("No 'default_key' given! Using first key on secring.") - if isinstance(data, file): + if hasattr(data, 'read'): result = self._sign_file(data, **kwargs) elif not _is_stream(data): stream = _make_binary_stream(data, self._encoding)