unable to catch this exception

M

mk

Exception in thread Thread-9 (most likely raised during interpreter
shutdown):
Traceback (most recent call last):
File "/usr/local/lib/python2.6/threading.py", line 522, in
__bootstrap_inner
File "/var/www/html/cssh.py", line 875, in run
File "/var/www/html/cssh.py", line 617, in ssh_connect
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute
'BadAuthenticationType'


This happens on interpreter shutdown, even though I do try to catch the
AttributeError exception:

try:
fake = paramiko.BadAuthenticationType
try:
self.conobj.connect(self.ip, username=self.username,
key_filename=self.sshprivkey, port=self.port, timeout=opts.timeout)
loginsuccess = True
except paramiko.BadAuthenticationType, e: # this is line 617
self.conerror = str(e)
except paramiko.SSHException, e:
self.conerror = str(e)
except socket.timeout, e:
self.conerror = str(e)
except socket.error, e:
self.conerror = str(e)
except AttributeError:
# this happens on interpreter shutdown
self.conerror = 'shutdown'


It's clear what happens: paramiko gets its attributes cleared or the
module perhaps gets unloaded and as result "paramiko" label leads to
None, which obviously has no attribute BadAuthenticationType.

However, even though this is surrounded by try .. except AttributeError
block, it evidently isn't catch. How to catch that exception? Or at
least preven displaying this message?

Regards,
mk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top