Mercurial > python-cmd2
changeset 143:f0fa9965a985
catch xclip-absent input errors
author | catherine@dellzilla |
---|---|
date | Tue, 18 Nov 2008 13:12:43 -0500 |
parents | c05afe3b5501 |
children | 2d3477aa79d4 |
files | cmd2.py |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/cmd2.py Mon Nov 17 14:32:18 2008 -0500 +++ b/cmd2.py Tue Nov 18 13:12:43 2008 -0500 @@ -313,14 +313,14 @@ statekeeper = None stop = 0 if statement.input: - if statement.inputFrom: - try: + try: + if statement.inputFrom: newinput = open(statement.inputFrom, 'r').read() - except OSError, e: - print e - return 0 - else: - newinput = getPasteBuffer() + else: + newinput = getPasteBuffer() + except (OSError,), e: + print e + return 0 start, end = self.redirectInPattern.scanString(statement.fullStatement).next()[1:] return self.onecmd('%s%s%s' % (statement.fullStatement[:start], newinput, statement.fullStatement[end:]))