#1152 pungi-koji --version crashes in Python 3
Closed: Fixed 4 years ago by lsedlar. Opened 5 years ago by ktdreyer.

On Fedora 29:

pungi-koji --version
Exception: a bytes-like object is required, not 'str'
Traceback (most recent call last):
  File "/usr/bin/pungi-koji", line 489, in <module>
    main()
  File "/usr/bin/pungi-koji", line 176, in main
    opts = parser.parse_args()
  File "/usr/lib64/python3.7/argparse.py", line 1749, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib64/python3.7/argparse.py", line 1781, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib64/python3.7/argparse.py", line 1987, in _parse_known_args
    start_index = consume_optional(start_index)
  File "/usr/lib64/python3.7/argparse.py", line 1927, in consume_optional
    take_action(action, args, option_string)
  File "/usr/lib64/python3.7/argparse.py", line 1855, in take_action
    action(self, namespace, argument_values, option_string)
  File "/usr/lib64/python3.7/argparse.py", line 1063, in __call__
    parser._print_message(formatter.format_help(), _sys.stdout)
  File "/usr/lib64/python3.7/argparse.py", line 284, in format_help
    help = self._root_section.format_help()
  File "/usr/lib64/python3.7/argparse.py", line 215, in format_help
    item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib64/python3.7/argparse.py", line 215, in <listcomp>
    item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib64/python3.7/argparse.py", line 489, in _format_text
    if '%(prog)' in text:
TypeError: a bytes-like object is required, not 'str'

That stack trace inside argparse is not very helpful.

In Python 3, subprocess calls return bytes, not strings. This is probably causing the issue inside get_full_version().

Maybe we could have a unit test for that method.


Metadata Update from @lsedlar:
- Issue set to the milestone: 4.1.36

4 years ago

Login to comment on this ticket.

Metadata