gpg: Don't crash if python-gnupg cannot find the gnupg binary.

Reported traceback:
  File D:python27libsite-packagessupybotgpg.py, line 45, in <module>
    gnupg.GPG(gnupghome=None)
  File D:python27libsite-packagesgnupg.py, line 680, in __init__
    p = self._open_subprocess([--version])
  File D:python27libsite-packagesgnupg.py, line 726, in _open_subprocess
    return Popen(cmd, shell=False, stdin=PIPE, stdout=PIPE, stderr=PIPE)
  File D:python27libsubprocess.py, line 710, in __init__
    errread, errwrite)
  File D:python27libsubprocess.py, line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
This commit is contained in:
Valentin Lorentz 2015-05-17 12:10:11 +02:00
parent 5bd0001d02
commit 9cb967023e

View File

@ -28,6 +28,7 @@
###
import os
import traceback
import supybot.log as log
import supybot.conf as conf
@ -46,6 +47,11 @@ try:
except TypeError:
# This is the 'gnupg' library, not 'python-gnupg'.
gnupg = None
except OSError: # WindowsError?
gnupg = None
log.error('Cannot use GPG. python-gnupg is installed but cannot '
'find the gnupg executable.')
available = (gnupg is not None)