manolomartinez / greg

A command-line podcast aggregator
GNU General Public License v3.0
296 stars 37 forks source link

BUG: Custom date format not working #113

Open HeuristicPerson opened 3 years ago

HeuristicPerson commented 3 years ago

Hi, Manolo

It seems there is a bug in the custom date_format field implementation. When I try to use my own one (or even uncomment the default sample value provided in the original configuration), I'm getting a MissingSectionHeaderError as you can see below.

/appdata $ greg sync
Traceback (most recent call last):
  File "/usr/bin/greg", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.9/site-packages/greg/parser.py", line 138, in main
    function(vars(args))
  File "/usr/lib/python3.9/site-packages/greg/commands.py", line 150, in sync
    session = c.Session(args)
  File "/usr/lib/python3.9/site-packages/greg/classes.py", line 46, in __init__
    self.data_dir = self.retrieve_data_directory()
  File "/usr/lib/python3.9/site-packages/greg/classes.py", line 86, in retrieve_data_directory
    config.read([config_filename_global, self.config_filename_user])
  File "/usr/lib/python3.9/configparser.py", line 697, in read
    self._read(fp, filename)
  File "/usr/lib/python3.9/configparser.py", line 1082, in _read
    raise MissingSectionHeaderError(fpname, lineno, line) 
configparser.MissingSectionHeaderError: File contains no section headers.
file: '/home/appuser/.config/greg/greg.conf', line: 50
'date_format = %%y/%%m/%%d\n'

I'm using Python 3.9.5 under Alpine Linux 3.14.1 and I installed greg using pip3 install greg.

manolomartinez commented 2 years ago

Hi, sorry for the delay in getting back to you. I think the problem is with using slashes in the date_format placeholder. Which is admittedly very stupid, given that there are slashes in the example I give in greg.conf.

Does your own custom date format have slashes in it? If so, could you please try with another date_format, say, %%d_%%m_%%y, or whatever?