jspricke / python-remind

Python library to convert between Remind and iCalendar
GNU General Public License v3.0
13 stars 6 forks source link

include directives with Remind variables causing FileNotFoundError #10

Closed usonianhorizon closed 5 years ago

usonianhorizon commented 5 years ago

I believe that in line 102, new_file needs to be expanded before subsequent use since the path may make use of Remind variables. Many of my "rc" files use the following style of include directives since my remind dataset is multi-directory:

SET AGENDA_PATH_PREFIX "/home/auser/remind/agenda/"
include [AGENDA_PATH_PREFIX]/../.remindrc.rem

However, rem2ics errors on line 105 with the following since new_file is passed to getmtime (without expansion?):

Thank you.

  File "/home/auser/.virtualenvs/dav/bin/rem2ics", line 8, in <module>
    sys.exit(rem2ics())
  File "/home/auser/.virtualenvs/dav/lib/python3.6/site-packages/remind.py", line 592, in rem2ics
    remind = Remind(args.infile, zone, args.startdate, args.month, timedelta(minutes=args.alarm))
  File "/home/auser/.virtualenvs/dav/lib/python3.6/site-packages/remind.py", line 52, in __init__
    self._update()
  File "/home/auser/.virtualenvs/dav/lib/python3.6/site-packages/remind.py", line 256, in _update
    self._reminders = self._parse_remind(self._filename)
  File "/home/auser/.virtualenvs/dav/lib/python3.6/site-packages/remind.py", line 105, in _parse_remind
    mtime = getmtime(new_file)
  File "/home/auser/.virtualenvs/dav/lib/python3.6/genericpath.py", line 55, in getmtime
    return os.stat(filename).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: '[AGENDA_PATH_PREFIX]/../.remindrc.rem'
jspricke commented 5 years ago

Thanks a lot for creating that issue. I pushed a fixed version, can you try it?

usonianhorizon commented 4 years ago

Sorry. Been away. WILCO and get back to you.