summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDavanum Srinivas <dims@linux.vnet.ibm.com>2013-09-22 22:56:44 -0400
committerSergey Shepelev <temotor@gmail.com>2013-12-03 22:31:55 +0400
commit80633ab22486228a64184bb9d8d6fd0ea7977677 (patch)
tree070d9bd9c35f574a2e43dcd9d6d9ece5abb93b33 /examples
parent76c1fcf3e5587db5c831bd825c2ba4bdf46a28c7 (diff)
downloadeventlet-80633ab22486228a64184bb9d8d6fd0ea7977677.tar.gz
python3 compat: 2to3: `except E as e:` syntax
First step to Python 3 compatibility "2to3 -w -f except ." See [1] [1] http://docs.python.org/2/library/2to3.html#fixers
Diffstat (limited to 'examples')
-rw-r--r--examples/chat_server.py2
-rw-r--r--examples/twisted/twisted_client.py2
-rw-r--r--examples/twisted/twisted_server.py2
-rw-r--r--examples/zmq_chat.py2
4 files changed, 4 insertions, 4 deletions
diff --git a/examples/chat_server.py b/examples/chat_server.py
index 3577e98..3c12c6d 100644
--- a/examples/chat_server.py
+++ b/examples/chat_server.py
@@ -13,7 +13,7 @@ def read_chat_forever(writer, reader):
if p is not writer: # Don't echo
p.write(line)
p.flush()
- except socket.error, e:
+ except socket.error as e:
# ignore broken pipes, they just mean the participant
# closed its connection already
if e[0] != 32:
diff --git a/examples/twisted/twisted_client.py b/examples/twisted/twisted_client.py
index 38061aa..78256bd 100644
--- a/examples/twisted/twisted_client.py
+++ b/examples/twisted/twisted_client.py
@@ -21,6 +21,6 @@ conn.write('GET / HTTP/1.0\r\n\r\n')
try:
for num, line in enumerate(conn):
print '%3s %r' % (num, line)
-except ConnectionClosed, ex:
+except ConnectionClosed as ex:
print ex
diff --git a/examples/twisted/twisted_server.py b/examples/twisted/twisted_server.py
index 41352f1..f5a3cb6 100644
--- a/examples/twisted/twisted_server.py
+++ b/examples/twisted/twisted_server.py
@@ -26,7 +26,7 @@ class Chat:
for buddy in self.participants:
if buddy is not conn:
buddy.sendline('from %s: %s' % (peer, line))
- except Exception, ex:
+ except Exception as ex:
print peer, ex
else:
print peer, 'connection done'
diff --git a/examples/zmq_chat.py b/examples/zmq_chat.py
index cd07f80..074c326 100644
--- a/examples/zmq_chat.py
+++ b/examples/zmq_chat.py
@@ -36,7 +36,7 @@ def read_chat_forever(reader, pub_socket):
try:
pub_socket.send_pyobj((who, line))
- except socket.error, e:
+ except socket.error as e:
# ignore broken pipes, they just mean the participant
# closed its connection already
if e[0] != 32: