summaryrefslogtreecommitdiffstats
path: root/Demo
diff options
context:
space:
mode:
Diffstat (limited to 'Demo')
-rw-r--r--Demo/cgi/wiki.py2
-rwxr-xr-xDemo/comparisons/regextest.py2
-rwxr-xr-xDemo/comparisons/systemtest.py4
-rwxr-xr-xDemo/parser/test_parser.py2
-rw-r--r--Demo/parser/unparse.py2
-rwxr-xr-xDemo/pdist/FSProxy.py2
-rwxr-xr-xDemo/pdist/cmdfw.py4
-rwxr-xr-xDemo/pdist/cmptree.py4
-rwxr-xr-xDemo/pdist/cvslock.py4
-rwxr-xr-xDemo/pdist/rrcs.py4
-rwxr-xr-xDemo/pysvr/pysvr.py10
-rw-r--r--Demo/rpc/nfsclient.py3
-rw-r--r--Demo/rpc/rpc.py7
-rwxr-xr-xDemo/scripts/eqfix.py12
-rwxr-xr-xDemo/scripts/ftpstats.py4
-rwxr-xr-xDemo/scripts/mboxconvert.py6
-rwxr-xr-xDemo/scripts/newslist.py2
-rwxr-xr-xDemo/scripts/pp.py2
-rwxr-xr-xDemo/scripts/update.py6
-rwxr-xr-xDemo/sockets/gopher.py10
-rwxr-xr-xDemo/sockets/telnet.py2
-rw-r--r--Demo/threads/find.py4
-rw-r--r--Demo/threads/telnet.py2
-rwxr-xr-xDemo/tkinter/guido/AttrDialog.py14
-rwxr-xr-xDemo/tkinter/guido/ManPage.py2
-rwxr-xr-xDemo/tkinter/guido/mbox.py2
-rwxr-xr-xDemo/tkinter/guido/tkman.py2
-rwxr-xr-xDemo/tkinter/guido/wish.py2
28 files changed, 61 insertions, 61 deletions
diff --git a/Demo/cgi/wiki.py b/Demo/cgi/wiki.py
index ee094a8..2f944d6 100644
--- a/Demo/cgi/wiki.py
+++ b/Demo/cgi/wiki.py
@@ -119,5 +119,5 @@ class WikiPage:
f.write('\n')
f.close()
return ""
- except IOError, err:
+ except IOError as err:
return "IOError: %s" % str(err)
diff --git a/Demo/comparisons/regextest.py b/Demo/comparisons/regextest.py
index b27d741..1fab052 100755
--- a/Demo/comparisons/regextest.py
+++ b/Demo/comparisons/regextest.py
@@ -28,7 +28,7 @@ def main():
for file in sys.argv[1:]:
try:
fp = open(file, 'r')
- except IOError, msg:
+ except IOError as msg:
print "%s: %s" % (file, msg)
continue
lineno = 0
diff --git a/Demo/comparisons/systemtest.py b/Demo/comparisons/systemtest.py
index bbc313b..d3fc72b 100755
--- a/Demo/comparisons/systemtest.py
+++ b/Demo/comparisons/systemtest.py
@@ -41,7 +41,7 @@ def main():
def reportboguslinks(prefix):
try:
names = os.listdir('.')
- except os.error, msg:
+ except os.error as msg:
print "%s%s: can't list: %s" % (prefix, '.', msg)
return
names.sort()
@@ -62,7 +62,7 @@ def reportboguslinks(prefix):
elif S_ISDIR(mode):
try:
os.chdir(name)
- except os.error, msg:
+ except os.error as msg:
print "%s%s: can't chdir: %s" % \
(prefix, name, msg)
continue
diff --git a/Demo/parser/test_parser.py b/Demo/parser/test_parser.py
index be39bca..1589f3b 100755
--- a/Demo/parser/test_parser.py
+++ b/Demo/parser/test_parser.py
@@ -17,7 +17,7 @@ def testChunk(t, fileName):
# against a large source file like Tkinter.py.
ast = None
new = parser.tuple2ast(tup)
- except parser.ParserError, err:
+ except parser.ParserError as err:
print
print 'parser module raised exception on input file', fileName + ':'
traceback.print_exc()
diff --git a/Demo/parser/unparse.py b/Demo/parser/unparse.py
index 32acbed..1c6e933 100644
--- a/Demo/parser/unparse.py
+++ b/Demo/parser/unparse.py
@@ -492,7 +492,7 @@ def testdir(a):
print 'Testing %s' % fullname
try:
roundtrip(fullname, output)
- except Exception, e:
+ except Exception as e:
print ' Failed to compile, exception is %s' % repr(e)
elif os.path.isdir(fullname):
testdir(fullname)
diff --git a/Demo/pdist/FSProxy.py b/Demo/pdist/FSProxy.py
index a1ab635..dad4015 100755
--- a/Demo/pdist/FSProxy.py
+++ b/Demo/pdist/FSProxy.py
@@ -87,7 +87,7 @@ class FSProxyLocal:
fs = macfs.FSSpec(name)
c, t = fs.GetCreatorType()
if t != 'TEXT': return 0
- except macfs.error, msg:
+ except macfs.error as msg:
print "***", name, msg
return 0
else:
diff --git a/Demo/pdist/cmdfw.py b/Demo/pdist/cmdfw.py
index e2edd0a..47d13bc 100755
--- a/Demo/pdist/cmdfw.py
+++ b/Demo/pdist/cmdfw.py
@@ -42,7 +42,7 @@ class CommandFrameWork:
if args is None: args = sys.argv[1:]
try:
opts, args = getopt.getopt(args, self.GlobalFlags)
- except getopt.error, msg:
+ except getopt.error as msg:
return self.usage(msg)
self.options(opts)
if not args:
@@ -62,7 +62,7 @@ class CommandFrameWork:
flags = ''
try:
opts, args = getopt.getopt(args[1:], flags)
- except getopt.error, msg:
+ except getopt.error as msg:
return self.usage(
"subcommand %s: " % cmd + str(msg))
self.ready()
diff --git a/Demo/pdist/cmptree.py b/Demo/pdist/cmptree.py
index fa06f5f..5031869 100755
--- a/Demo/pdist/cmptree.py
+++ b/Demo/pdist/cmptree.py
@@ -135,7 +135,7 @@ def compare(local, remote, mode):
def sendfile(local, remote, name):
try:
remote.create(name)
- except (IOError, os.error), msg:
+ except (IOError, os.error) as msg:
print "cannot create:", msg
return
@@ -171,7 +171,7 @@ def recvfile(local, remote, name):
def recvfile_real(local, remote, name):
try:
local.create(name)
- except (IOError, os.error), msg:
+ except (IOError, os.error) as msg:
print "cannot create:", msg
return
diff --git a/Demo/pdist/cvslock.py b/Demo/pdist/cvslock.py
index 8f6d008..6484e71 100755
--- a/Demo/pdist/cvslock.py
+++ b/Demo/pdist/cvslock.py
@@ -129,7 +129,7 @@ class Lock:
self.lockdir = self.cvslck
os.mkdir(self.cvslck, 0777)
return
- except os.error, msg:
+ except os.error as msg:
self.lockdir = None
if msg[0] == EEXIST:
try:
@@ -234,7 +234,7 @@ def MultipleWriteLock(repositories, delay = DELAY):
for r in repositories:
try:
locks.append(WriteLock(r, 0))
- except Locked, instance:
+ except Locked as instance:
del locks
break
else:
diff --git a/Demo/pdist/rrcs.py b/Demo/pdist/rrcs.py
index 4d23e6c..540d296 100755
--- a/Demo/pdist/rrcs.py
+++ b/Demo/pdist/rrcs.py
@@ -22,7 +22,7 @@ def main():
raise getopt.error, "unknown command"
coptset, func = commands[cmd]
copts, files = getopt.getopt(rest, coptset)
- except getopt.error, msg:
+ except getopt.error as msg:
print msg
print "usage: rrcs [options] command [options] [file] ..."
print "where command can be:"
@@ -41,7 +41,7 @@ def main():
for fn in files:
try:
func(x, copts, fn)
- except (IOError, os.error), msg:
+ except (IOError, os.error) as msg:
print "%s: %s" % (fn, msg)
def checkin(x, copts, fn):
diff --git a/Demo/pysvr/pysvr.py b/Demo/pysvr/pysvr.py
index 3b692b3..b1b7565 100755
--- a/Demo/pysvr/pysvr.py
+++ b/Demo/pysvr/pysvr.py
@@ -21,14 +21,14 @@ def main():
opts, args = getopt.getopt(sys.argv[1:], "")
if len(args) > 1:
raise getopt.error, "Too many arguments."
- except getopt.error, msg:
+ except getopt.error as msg:
usage(msg)
for o, a in opts:
pass
if args:
try:
port = string.atoi(args[0])
- except ValueError, msg:
+ except ValueError as msg:
usage(msg)
else:
port = PORT
@@ -83,7 +83,7 @@ def run_interpreter(stdin, stdout):
source = source + line
try:
code = compile_command(source)
- except SyntaxError, err:
+ except SyntaxError as err:
source = ""
traceback.print_exception(SyntaxError, err, None, file=stdout)
continue
@@ -92,7 +92,7 @@ def run_interpreter(stdin, stdout):
source = ""
try:
run_command(code, stdin, stdout, globals)
- except SystemExit, how:
+ except SystemExit as how:
if how:
try:
how = str(how)
@@ -109,7 +109,7 @@ def run_command(code, stdin, stdout, globals):
sys.stdin = stdin
try:
exec(code, globals)
- except SystemExit, how:
+ except SystemExit as how:
raise SystemExit, how, sys.exc_info()[2]
except:
type, value, tb = sys.exc_info()
diff --git a/Demo/rpc/nfsclient.py b/Demo/rpc/nfsclient.py
index 8e5a199..3890aff 100644
--- a/Demo/rpc/nfsclient.py
+++ b/Demo/rpc/nfsclient.py
@@ -194,8 +194,7 @@ def test():
fh = sf[1]
if fh:
ncl = NFSClient(host)
- as = ncl.Getattr(fh)
- print as
+ print ncl.Getattr(fh)
list = ncl.Listdir(fh)
for item in list: print item
mcl.Umnt(filesys)
diff --git a/Demo/rpc/rpc.py b/Demo/rpc/rpc.py
index 141fe09..f7231c1 100644
--- a/Demo/rpc/rpc.py
+++ b/Demo/rpc/rpc.py
@@ -330,7 +330,8 @@ def bindresvport(sock, host):
try:
sock.bind((host, i))
return last_resv_port_tried
- except socket.error, (errno, msg):
+ except socket.error as e:
+ (errno, msg) = e
if errno != 114:
raise socket.error, (errno, msg)
raise RuntimeError, 'can\'t assign reserved port'
@@ -765,7 +766,7 @@ class TCPServer(Server):
call = recvrecord(sock)
except EOFError:
break
- except socket.error, msg:
+ except socket.error as msg:
print 'socket error:', msg
break
reply = self.handle(call)
@@ -866,7 +867,7 @@ def testsvr():
s = S('', 0x20000000, 1, 0)
try:
s.unregister()
- except RuntimeError, msg:
+ except RuntimeError as msg:
print 'RuntimeError:', msg, '(ignored)'
s.register()
print 'Service started...'
diff --git a/Demo/scripts/eqfix.py b/Demo/scripts/eqfix.py
index 35c43aa..497ab20 100755
--- a/Demo/scripts/eqfix.py
+++ b/Demo/scripts/eqfix.py
@@ -62,7 +62,7 @@ def recursedown(dirname):
bad = 0
try:
names = os.listdir(dirname)
- except os.error, msg:
+ except os.error as msg:
err('%s: cannot list directory: %r\n' % (dirname, msg))
return 1
names.sort()
@@ -83,7 +83,7 @@ def fix(filename):
## dbg('fix(%r)\n' % (dirname,))
try:
f = open(filename, 'r')
- except IOError, msg:
+ except IOError as msg:
err('%s: cannot open: %r\n' % (filename, msg))
return 1
head, tail = os.path.split(filename)
@@ -120,7 +120,7 @@ def fix(filename):
if g is None:
try:
g = open(tempname, 'w')
- except IOError, msg:
+ except IOError as msg:
f.close()
err('%s: cannot create: %r\n' % (tempname, msg))
return 1
@@ -144,17 +144,17 @@ def fix(filename):
try:
statbuf = os.stat(filename)
os.chmod(tempname, statbuf[ST_MODE] & 07777)
- except os.error, msg:
+ except os.error as msg:
err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
# Then make a backup of the original file as filename~
try:
os.rename(filename, filename + '~')
- except os.error, msg:
+ except os.error as msg:
err('%s: warning: backup failed (%r)\n' % (filename, msg))
# Now move the temp file to the original file
try:
os.rename(tempname, filename)
- except os.error, msg:
+ except os.error as msg:
err('%s: rename failed (%r)\n' % (filename, msg))
return 1
# Return succes
diff --git a/Demo/scripts/ftpstats.py b/Demo/scripts/ftpstats.py
index 5c1599e..c7c0749 100755
--- a/Demo/scripts/ftpstats.py
+++ b/Demo/scripts/ftpstats.py
@@ -25,7 +25,7 @@ def main():
search = None
try:
opts, args = getopt.getopt(sys.argv[1:], 'm:s:')
- except getopt.error, msg:
+ except getopt.error as msg:
print msg
print 'usage: ftpstats [-m maxitems] [file]'
sys.exit(2)
@@ -41,7 +41,7 @@ def main():
else:
try:
f = open(file, 'r')
- except IOError, msg:
+ except IOError as msg:
print file, ':', msg
sys.exit(1)
bydate = {}
diff --git a/Demo/scripts/mboxconvert.py b/Demo/scripts/mboxconvert.py
index 8c462f3..8da37bf 100755
--- a/Demo/scripts/mboxconvert.py
+++ b/Demo/scripts/mboxconvert.py
@@ -16,7 +16,7 @@ def main():
dofile = mmdf
try:
opts, args = getopt.getopt(sys.argv[1:], 'f')
- except getopt.error, msg:
+ except getopt.error as msg:
sys.stderr.write('%s\n' % msg)
sys.exit(2)
for o, a in opts:
@@ -33,7 +33,7 @@ def main():
elif os.path.isfile(arg):
try:
f = open(arg)
- except IOError, msg:
+ except IOError as msg:
sys.stderr.write('%s: %s\n' % (arg, msg))
sts = 1
continue
@@ -56,7 +56,7 @@ def mh(dir):
fn = os.path.join(dir, msg)
try:
f = open(fn)
- except IOError, msg:
+ except IOError as msg:
sys.stderr.write('%s: %s\n' % (fn, msg))
sts = 1
continue
diff --git a/Demo/scripts/newslist.py b/Demo/scripts/newslist.py
index a631214..0111ace 100755
--- a/Demo/scripts/newslist.py
+++ b/Demo/scripts/newslist.py
@@ -330,7 +330,7 @@ def main():
else:
s = NNTP(newshost)
connected = 1
- except (nntplib.error_temp, nntplib.error_perm), x:
+ except (nntplib.error_temp, nntplib.error_perm) as x:
print 'Error connecting to host:', x
print 'I\'ll try to use just the local list.'
connected = 0
diff --git a/Demo/scripts/pp.py b/Demo/scripts/pp.py
index 0491fa9..2530ea3 100755
--- a/Demo/scripts/pp.py
+++ b/Demo/scripts/pp.py
@@ -35,7 +35,7 @@ PFLAG = 0
try:
optlist, ARGS = getopt.getopt(sys.argv[1:], 'acde:F:np')
-except getopt.error, msg:
+except getopt.error as msg:
sys.stderr.write(sys.argv[0] + ': ' + msg + '\n')
sys.exit(2)
diff --git a/Demo/scripts/update.py b/Demo/scripts/update.py
index eac1a22..a965e4a 100755
--- a/Demo/scripts/update.py
+++ b/Demo/scripts/update.py
@@ -19,7 +19,7 @@ class FileObj:
self.changed = 0
try:
self.lines = open(filename, 'r').readlines()
- except IOError, msg:
+ except IOError as msg:
print '*** Can\'t open "%s":' % filename, msg
self.lines = None
return
@@ -32,7 +32,7 @@ class FileObj:
try:
os.rename(self.filename, self.filename + '~')
fp = open(self.filename, 'w')
- except (os.error, IOError), msg:
+ except (os.error, IOError) as msg:
print '*** Can\'t rewrite "%s":' % self.filename, msg
return
print 'writing', self.filename
@@ -67,7 +67,7 @@ def main():
if sys.argv[1:]:
try:
fp = open(sys.argv[1], 'r')
- except IOError, msg:
+ except IOError as msg:
print 'Can\'t open "%s":' % sys.argv[1], msg
sys.exit(1)
else:
diff --git a/Demo/sockets/gopher.py b/Demo/sockets/gopher.py
index 2c46da6..0635ac1 100755
--- a/Demo/sockets/gopher.py
+++ b/Demo/sockets/gopher.py
@@ -142,7 +142,7 @@ def browser(*args):
raise RuntimeError, 'too many args'
try:
browse_menu(selector, host, port)
- except socket.error, msg:
+ except socket.error as msg:
print 'Socket error:', msg
sys.exit(1)
except KeyboardInterrupt:
@@ -202,7 +202,7 @@ def browse_textfile(selector, host, port):
p = os.popen('${PAGER-more}', 'w')
x = SaveLines(p)
get_alt_textfile(selector, host, port, x.writeln)
- except IOError, msg:
+ except IOError as msg:
print 'IOError:', msg
if x:
x.close()
@@ -213,7 +213,7 @@ def browse_textfile(selector, host, port):
try:
get_alt_textfile(selector, host, port, x.writeln)
print 'Done.'
- except IOError, msg:
+ except IOError as msg:
print 'IOError:', msg
x.close()
@@ -311,7 +311,7 @@ def open_savefile():
cmd = savefile[1:].strip()
try:
p = os.popen(cmd, 'w')
- except IOError, msg:
+ except IOError as msg:
print repr(cmd), ':', msg
return None
print 'Piping through', repr(cmd), '...'
@@ -320,7 +320,7 @@ def open_savefile():
savefile = os.path.expanduser(savefile)
try:
f = open(savefile, 'w')
- except IOError, msg:
+ except IOError as msg:
print repr(savefile), ':', msg
return None
print 'Saving to', repr(savefile), '...'
diff --git a/Demo/sockets/telnet.py b/Demo/sockets/telnet.py
index d50c37f..6bc9bcc 100755
--- a/Demo/sockets/telnet.py
+++ b/Demo/sockets/telnet.py
@@ -52,7 +52,7 @@ def main():
#
try:
s.connect((host, port))
- except error, msg:
+ except error as msg:
sys.stderr.write('connect failed: ' + repr(msg) + '\n')
sys.exit(1)
#
diff --git a/Demo/threads/find.py b/Demo/threads/find.py
index 14148b8..68ca155 100644
--- a/Demo/threads/find.py
+++ b/Demo/threads/find.py
@@ -131,7 +131,7 @@ def selector(dir, name, fullname, stat):
def find(dir, pred, wq):
try:
names = os.listdir(dir)
- except os.error, msg:
+ except os.error as msg:
print repr(dir), ':', msg
return
for name in names:
@@ -139,7 +139,7 @@ def find(dir, pred, wq):
fullname = os.path.join(dir, name)
try:
stat = os.lstat(fullname)
- except os.error, msg:
+ except os.error as msg:
print repr(fullname), ':', msg
continue
if pred(dir, name, fullname, stat):
diff --git a/Demo/threads/telnet.py b/Demo/threads/telnet.py
index 707a353..09f3bd9 100644
--- a/Demo/threads/telnet.py
+++ b/Demo/threads/telnet.py
@@ -56,7 +56,7 @@ def main():
#
try:
s.connect((host, port))
- except error, msg:
+ except error as msg:
sys.stderr.write('connect failed: %r\n' % (msg,))
sys.exit(1)
#
diff --git a/Demo/tkinter/guido/AttrDialog.py b/Demo/tkinter/guido/AttrDialog.py
index 9fa699e..d8b2571 100755
--- a/Demo/tkinter/guido/AttrDialog.py
+++ b/Demo/tkinter/guido/AttrDialog.py
@@ -156,7 +156,7 @@ class PackDialog(Dialog):
self.current = self.var.get()
try:
self.dialog.widget.pack(**{self.option: self.current})
- except TclError, msg:
+ except TclError as msg:
print msg
self.refresh()
@@ -212,7 +212,7 @@ class RemotePackDialog(PackDialog):
'pack',
'info',
self.widget))
- except TclError, msg:
+ except TclError as msg:
print msg
return
dict = {}
@@ -239,7 +239,7 @@ class RemotePackDialog(PackDialog):
'-'+self.option,
self.dialog.master.tk.merge(
self.current))
- except TclError, msg:
+ except TclError as msg:
print msg
self.refresh()
@@ -285,7 +285,7 @@ class WidgetDialog(Dialog):
self.current = self.var.get()
try:
self.dialog.widget[self.option] = self.current
- except TclError, msg:
+ except TclError as msg:
print msg
self.refresh()
@@ -374,7 +374,7 @@ class RemoteWidgetDialog(WidgetDialog):
self.master.send(self.app,
self.widget,
'config'))
- except TclError, msg:
+ except TclError as msg:
print msg
return
dict = {}
@@ -398,7 +398,7 @@ class RemoteWidgetDialog(WidgetDialog):
'config',
'-'+self.option,
self.current)
- except TclError, msg:
+ except TclError as msg:
print msg
self.refresh()
@@ -445,7 +445,7 @@ def opendialogs(e):
if widget == '.': continue
try:
RemotePackDialog(list, list.app, widget)
- except TclError, msg:
+ except TclError as msg:
print msg
test()
diff --git a/Demo/tkinter/guido/ManPage.py b/Demo/tkinter/guido/ManPage.py
index 221af88..b189b64 100755
--- a/Demo/tkinter/guido/ManPage.py
+++ b/Demo/tkinter/guido/ManPage.py
@@ -95,7 +95,7 @@ class EditableManPage(ScrolledText):
self._parseline('')
try:
self.tk.deletefilehandler(self.fp)
- except TclError, msg:
+ except TclError as msg:
pass
self.fp.close()
self.fp = None
diff --git a/Demo/tkinter/guido/mbox.py b/Demo/tkinter/guido/mbox.py
index 3c36d88..47c38b9 100755
--- a/Demo/tkinter/guido/mbox.py
+++ b/Demo/tkinter/guido/mbox.py
@@ -27,7 +27,7 @@ def main():
seq = 'all'
try:
opts, args = getopt.getopt(sys.argv[1:], '')
- except getopt.error, msg:
+ except getopt.error as msg:
print msg
sys.exit(2)
for arg in args:
diff --git a/Demo/tkinter/guido/tkman.py b/Demo/tkinter/guido/tkman.py
index 6b0b641..810bdf8 100755
--- a/Demo/tkinter/guido/tkman.py
+++ b/Demo/tkinter/guido/tkman.py
@@ -216,7 +216,7 @@ class SelectionBox:
prog = re.compile(search, map)
else:
prog = re.compile(search)
- except re.error, msg:
+ except re.error as msg:
self.frame.bell()
print 'Regex error:', msg
return
diff --git a/Demo/tkinter/guido/wish.py b/Demo/tkinter/guido/wish.py
index 35e012c..2367e25 100755
--- a/Demo/tkinter/guido/wish.py
+++ b/Demo/tkinter/guido/wish.py
@@ -23,7 +23,7 @@ while 1:
tk.record(line)
try:
result = tk.call('eval', cmd)
- except _tkinter.TclError, msg:
+ except _tkinter.TclError as msg:
print 'TclError:', msg
else:
if result: print result