Skip to content

Commit eeea313

Browse files
author
Will Trimble
committed
Trap OSErrors in post_file
1 parent fcc0fae commit eeea313

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

mglib/mglib.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ def post_file(url, keyname, filename, data={}, auth=None, debug=False):
200200
sys.stderr.write("ERROR (%s): %s\n" %(error.code, error.read()))
201201
finally:
202202
sys.exit(1)
203+
except OSError as error:
204+
sys.stderr.write("ERROR with post_file\n")
205+
sys.stderr.write("ERROR (%s): %s\n" %(error.code, error.read()))
203206
if not res:
204207
sys.stderr.write("ERROR: no results returned\n")
205208
sys.exit(1)

0 commit comments

Comments
 (0)