Skip to content

Commit 464e18e

Browse files
authored
Merge pull request #5 from rkdarst/rkdarst/errors-to-stderr
Print error messages to stderr, not stdout
2 parents 2c6ec02 + a8b358c commit 464e18e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

yaml2ics.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ def event_from_yaml(event_yaml: dict) -> ics.Event:
4343
interval = repeat['interval']
4444

4545
if not len(interval) == 1:
46-
print('Error: interval must specify seconds, minutes, hours, days, weeks, months, or years only')
46+
print('Error: interval must specify seconds, minutes, hours, days, weeks, months, or years only', file=sys.stderr)
4747
sys.exit(-1)
4848

4949
interval_measure = list(interval.keys())[0]
5050
if interval_measure not in interval_type:
51-
print('Error: expected interval to be specified in seconds, minutes, hours, days, weeks, months, or years only')
51+
print('Error: expected interval to be specified in seconds, minutes, hours, days, weeks, months, or years only', file=sys.stderr)
5252
sys.exit(-1)
5353

5454
if 'until' not in repeat:
55-
print('Error: must specify end date for repeating events')
55+
print('Error: must specify end date for repeating events', file=sys.stderr)
5656
sys.exit(-1)
5757

5858
event.end = d.get('end', None)
@@ -104,7 +104,7 @@ def files_to_calendar(files: list) -> ics.Calendar:
104104
files = sys.argv[1:]
105105
for f in files:
106106
if not os.path.isfile(f):
107-
print(f'Error: {f} is not a file')
107+
print(f'Error: {f} is not a file', file=sys.stderr)
108108
sys.exit(-1)
109109

110110
calendar = files_to_calendar(files)

0 commit comments

Comments
 (0)