From 2d2ac70f23796e32f9b6b9eabae4603a141f8ea2 Mon Sep 17 00:00:00 2001 From: Razvan Deaconescu Date: Thu, 15 Apr 2010 11:42:10 +0300 Subject: [PATCH] autorun: "port" exception related code to Python 2.5 --- autorun/commander/Commander.py | 6 +++--- autorun/commander/SSHCommander.py | 4 ++-- autorun/commander/XMLParser.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/autorun/commander/Commander.py b/autorun/commander/Commander.py index ccf595e..83effec 100644 --- a/autorun/commander/Commander.py +++ b/autorun/commander/Commander.py @@ -27,7 +27,7 @@ class Commander(Thread): self.sshc.connect(hostname=hostname, username=username, port=port) stdin, stdout, stderr = self.sshc.exec_command(comm) print stdout.readlines() - except Exception as e: + except Exception, e: print e finally: self.sshc.close() @@ -37,7 +37,7 @@ class Commander(Thread): self.sshc.connect(hostname=hostname, username=username, port=port) for c in comms: stdin, stdout, stderr = self.sshc.exec_command(comm) - except Exception as e: + except Exception, e: print e finally: self.sshc.close() @@ -51,7 +51,7 @@ class Commander(Thread): self.sendMsg(pickle.dumps(config_data)) response = self.recvMsg() print "->>>>>>>>>>>>>>>>>>>>>>>>>", response - except Exception as e: + except Exception, e: print e finally: self.sock.close() diff --git a/autorun/commander/SSHCommander.py b/autorun/commander/SSHCommander.py index 5130f8b..b8944ae 100644 --- a/autorun/commander/SSHCommander.py +++ b/autorun/commander/SSHCommander.py @@ -20,7 +20,7 @@ class SSHCommander: self.sshclient.connect(hostname=self.hostname, username=self.username, pkey=self.pkey, port=self.port) #self.channel = self.sshclient.opensession(); #self.sshclient.connect(username=self.username, pkey=self.pkey) - except Exception as e: + except Exception, e: print e self.sshclient.close() @@ -29,7 +29,7 @@ class SSHCommander: #self.channel = self.sshclient.open_session(); stdin, stdout, stderr = self.sshclient.exec_command(comm) print stdout.readlines() - except Exception as e: + except Exception, e: print e self.sshclient.close() diff --git a/autorun/commander/XMLParser.py b/autorun/commander/XMLParser.py index 25be3af..3c8f6fa 100644 --- a/autorun/commander/XMLParser.py +++ b/autorun/commander/XMLParser.py @@ -56,7 +56,7 @@ class Nodes: client_paths [client_id]=elem2[0].text; list.append(client_paths); self.nodes.append(Node(id, list)) - except IOError as e: + except IOError, e: print e return None @@ -85,7 +85,7 @@ class Swarm: id = elem.get("id") list = [elem2.text for elem2 in elem[:len(elem)-1]] self.swarm.append(SwarmInstance(id, list)) - except IOError as e: + except IOError, e: print e return None -- 2.20.1