lrq3000 / pyFileFixity

📂🛡️Suite of tools for file fixity (data protection for long term storage⌛) using redundant error correcting codes, hash auditing and duplications with majority vote, all in pure Python🐍
MIT License
129 stars 9 forks source link

Update structural_adaptive_ecc.py #5

Closed cpburnz closed 5 years ago

cpburnz commented 6 years ago

I installed pyFileFixity v2.3.1 from PyPI on Debian 10 (testing) with Python 2.7.14. I tried running

python -m pyFileFixity.structural_adaptive_ecc --help

and I was greeted with the error:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/structural_adaptive_ecc.py", line 792, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/structural_adaptive_ecc.py", line 395, in main
    args = main_parser.parse_args(argv) # Storing all arguments to args
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/lib/argparse.py", line 1703, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/lib/argparse.py", line 1735, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/lib/argparse.py", line 1941, in _parse_known_args
    start_index = consume_optional(start_index)
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/lib/argparse.py", line 1881, in consume_optional
    take_action(action, args, option_string)
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/lib/argparse.py", line 1809, in take_action
    action(self, namespace, argument_values, option_string)
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/lib/argparse.py", line 1015, in __call__
    parser.print_help()
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/lib/argparse.py", line 2328, in print_help
    self._print_message(self.format_help(), file)
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/lib/argparse.py", line 2302, in format_help
    return formatter.format_help()
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/lib/argparse.py", line 300, in format_help
    help = self._root_section.format_help()
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/lib/argparse.py", line 230, in format_help
    func(*args)
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/lib/argparse.py", line 230, in format_help
    func(*args)
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/lib/argparse.py", line 536, in _format_action
    help_text = self._expand_help(action)
  File "/usr/local/lib/python2.7/dist-packages/pyFileFixity/lib/argparse.py", line 622, in _expand_help
    return self._get_help_string(action) % params
TypeError: %o format: a number is required, not dict

I traced the issue down to a couple help strings containing % symbols. The help strings in argparse are percent formatted so any literal % symbols have to be escaped by doubling them. This minor pull request fixes them.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 89.909% when pulling d23e5a62a27b74f90408d71925ad7c17c4cbbc15 on cpburnz:master into 8d44826394f9ea9e20f68a3fadfce4e5319baf2e on lrq3000:master.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 89.909% when pulling d23e5a62a27b74f90408d71925ad7c17c4cbbc15 on cpburnz:master into 8d44826394f9ea9e20f68a3fadfce4e5319baf2e on lrq3000:master.

lrq3000 commented 5 years ago

Thank you very much, I indeed had this issue several times, thought it was fixed everywhere but seems like one has passed by my vigilance, thank you very much :-)