1
0
Fork 0

Added an error handler for opening the output file.

This commit is contained in:
Tobias Leupold 2014-09-03 18:15:28 +02:00
parent e13d773fa6
commit 6786336ea3
1 changed files with 5 additions and 1 deletions

View File

@ -215,7 +215,11 @@ def writeSvgData(gpsData, width, height, maxPixels, dropSinglePoints, outfile):
# Open the requested output file or map to /dev/stdout
if outfile != '/dev/stdout':
fp = open(outfile, 'w')
try:
fp = open(outfile, 'w')
except IOError as error:
print('Can\'t open output file: {}. Terminating.'.format(error), file = sys.stderr)
sys.exit(1)
else:
fp = sys.stdout