novoid / Memacs

What did I do on February 14th 2007? Visualize your (digital) life in Org-mode
GNU General Public License v3.0
1.03k stars 66 forks source link

filenametimestamps exclusion not working if excluded directory contains "bad files" #97

Closed ajft closed 4 years ago

ajft commented 4 years ago

Having moved some old files into a directory scanned by memacs (including a "2002-02-29-journal.org" where there was no 2002-Feb-29), I've found that the "-x" switch of memacs_filenamestamps doesn't seem to exclude the directory from being parsed, only from being reported.

${MEMACS}/bin/memacs_filenametimestamps.py -a --skip-files-with-no-or-wrong-timestamp --skip-file-time-extraction -o ./test.org -f $HOME/lib -x $HOME/lib/repos -v : DEBUG 2020-05-14 21:41:04,153 handle_file: ################################################## DEBUG 2020-05-14 21:41:04,153 __handle_file: /home/ajft/lib/repos/org-site.hg/.hg/store/data/org/posts/2002-02-29-journal.org.i DEBUG 2020-05-14 21:41:04,154 handle_file: filename_timestamp_match? False ERROR 2020-05-14 21:41:04,158 Traceback (most recent call last): File "/home/ajft/src/memacs/memacs/lib/memacs.py", line 187, in handle_main self._main() File "/home/ajft/src/memacs/memacs/filenametimestamps.py", line 402, in _main self.handle_folder(folder) File "/home/ajft/src/memacs/memacs/filenametimestamps.py", line 122, in handle_folder self.__handle_file(file, rootdir) File "/home/ajft/src/memacs/memacs/filenametimestamps.py", line 354, in handle_file orgdate = OrgFormat.strdate(day1, inactive=self._args.inactive_timestamps) File "/home/ajft/.local/lib/python3.8/site-packages/orgformat/orgformat.py", line 318, in strdate tuple_date = time.strptime(components.group(1), File "/usr/lib/python3.8/_strptime.py", line 562, in _strptime_time tt = _strptime(data_string, format)[0] File "/usr/lib/python3.8/_strptime.py", line 534, in _strptime julian = datetime_date(year, month, day).toordinal() - \ ValueError: day is out of range for month Traceback (most recent call last): File "/home/ajft/src/memacs/bin/memacs_filenametimestamps.py", line 39, in memacs.handle_main() File "/home/ajft/src/memacs/memacs/lib/memacs.py", line 187, in handle_main self._main() File "/home/ajft/src/memacs/memacs/filenametimestamps.py", line 402, in _main self.handle_folder(folder) File "/home/ajft/src/memacs/memacs/filenametimestamps.py", line 122, in __handle_folder self.handle_file(file, rootdir) File "/home/ajft/src/memacs/memacs/filenametimestamps.py", line 354, in __handle_file orgdate = OrgFormat.strdate(day1, inactive=self._args.inactive_timestamps) File "/home/ajft/.local/lib/python3.8/site-packages/orgformat/orgformat.py", line 318, in strdate tuple_date = time.strptime(components.group(1), File "/usr/lib/python3.8/_strptime.py", line 562, in _strptime_time tt = _strptime(data_string, format)[0] File "/usr/lib/python3.8/_strptime.py", line 534, in _strptime julian = datetime_date(year, month, day).toordinal() - \ ValueError: day is out of range for month

novoid commented 4 years ago

Thanks @ajft, The issue should be fixed with the latest version.

I can not confirm that "the -x switch of memacs_filenamestamps doesn't seem to exclude the directory from being parsed, only from being reported". If you can reproduce it please open up another issue for that.