JimmXinu / FanFicFare

FanFicFare is a tool for making eBooks from stories on fanfiction and other web sites.
Other
738 stars 156 forks source link

Passwords that contain a % fail #986

Closed MrTyton closed 11 months ago

MrTyton commented 11 months ago

If you set a password inside of the .ini file, and it contains a %, then it considers it an escape character and crashes. This is solved by changing the password or by replacing the % with a %%, but should likely be noted in the documentation.

root@f126a1fa945c:/config# python3.9 -m fanficfare.cli -u "archiveofourown.org/works/26225191" --update-cover --non-interactive
Failed to read epub for update: ('%' must be followed by '%' or '(', found: '%z') Continuing with update=false
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.9/site-packages/fanficfare/cli.py", line 689, in <module>
    main()
  File "/usr/local/lib/python3.9/site-packages/fanficfare/cli.py", line 344, in main
    dispatch(options, urls, passed_defaultsini, passed_personalini, warn, fail)
  File "/usr/local/lib/python3.9/site-packages/fanficfare/cli.py", line 320, in dispatch
    do_download(url,
  File "/usr/local/lib/python3.9/site-packages/fanficfare/cli.py", line 435, in do_download
    adapter.getStoryMetadataOnly()
  File "/usr/local/lib/python3.9/site-packages/fanficfare/adapters/base_adapter.py", line 327, in getStoryMetadataOnly
    self.doExtractChapterUrlsAndMetadata(get_cover=get_cover)
  File "/usr/local/lib/python3.9/site-packages/fanficfare/adapters/base_adapter.py", line 431, in doExtractChapterUrlsAndMetadata
    return self.extractChapterUrlsAndMetadata()
  File "/usr/local/lib/python3.9/site-packages/fanficfare/adapters/adapter_archiveofourownorg.py", line 192, in extractChapterUrlsAndMetadata
    self.performLogin(url,data)
  File "/usr/local/lib/python3.9/site-packages/fanficfare/adapters/adapter_archiveofourownorg.py", line 129, in performLogin
    params['user[password]'] = self.getConfig("password")
  File "/usr/local/lib/python3.9/site-packages/fanficfare/configurable.py", line 1148, in getConfig
    return self.configuration.getConfig(key,default)
  File "/usr/local/lib/python3.9/site-packages/fanficfare/configurable.py", line 702, in getConfig
    return self.get_config(self.sectionslist,key,default)
  File "/usr/local/lib/python3.9/site-packages/fanficfare/configurable.py", line 733, in get_config
    val = self.get(section,key)
  File "/usr/local/lib/python3.9/configparser.py", line 799, in get
    return self._interpolation.before_get(self, section, option, value,
  File "/usr/local/lib/python3.9/configparser.py", line 395, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "/usr/local/lib/python3.9/configparser.py", line 442, in _interpolate_some
    raise InterpolationSyntaxError(
configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%z'
JimmXinu commented 11 months ago

This is a known issue. It's mentioned at least 8 times in the defaults.ini comments, albeit for date formats and output_css settings which are much more likely to need %.