[or-cvs] arma gets smarter about catching errors
arma at seul.org
arma at seul.org
Wed Jul 13 06:36:40 UTC 2005
Update of /home/or/cvsroot/control/python
In directory moria:/tmp/cvs-serv30022
Modified Files:
TorExample.py
Log Message:
arma gets smarter about catching errors
Index: TorExample.py
===================================================================
RCS file: /home/or/cvsroot/control/python/TorExample.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- TorExample.py 13 Jul 2005 06:28:42 -0000 1.7
+++ TorExample.py 13 Jul 2005 06:36:38 -0000 1.8
@@ -45,7 +45,10 @@
if fn is None:
print "Unrecognized command:",cmd
return
- fn()
+ try:
+ fn()
+ except ErrorReply, e:
+ print "Request failed: %s"%e
def run_set_config():
conn = getConnection()
@@ -63,22 +66,14 @@
def run_get_config():
conn = getConnection()
- try:
- opts = conn.get_option(sys.argv[1:])
- except ErrorReply, e:
- print "Lookup failed: %s."%e
- return
+ opts = conn.get_option(sys.argv[1:])
for k,v in opts:
print "KEY:",k
print "VALUE:",v
def run_get_info():
conn = getConnection()
- try:
- opts = conn.get_info(sys.argv[1:])
- except ErrorReply, e:
- print "Lookup failed: %s."%e
- return
+ opts = conn.get_info(sys.argv[1:])
for k in sys.argv[1:]:
print "KEY:",k
print "VALUE:",opts.get(k)
More information about the tor-commits
mailing list