kb icon indicating copy to clipboard operation
kb copied to clipboard

Error on fresh install - raise InvalidStyle(f'InvalidStyle: {name}') colored.exceptions.InvalidStyle: InvalidStyle: underlined

Open dfrawleyCohga opened this issue 10 months ago • 1 comments

I get the following error on install, tested on two different machines:

  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Python\Python313\Scripts\kb.exe\__main__.py", line 4, in <module>
    from kb.main import main
  File "C:\Python\Python313\Lib\site-packages\kb\main.py", line 20, in <module>
    from kb.commands.search import search
  File "C:\Python\Python313\Lib\site-packages\kb\commands\search.py", line 17, in <module>
    import kb.printer.search as printer
  File "C:\Python\Python313\Lib\site-packages\kb\printer\search.py", line 15, in <module>
    from kb.printer.style import ALT_BGROUND, BOLD, UND, RESET
  File "C:\Python\Python313\Lib\site-packages\kb\printer\style.py", line 20, in <module>
    UND = styler.set_style('underlined')
  File "C:\Python\Python313\Lib\site-packages\kb\styler.py", line 58, in set_style
    return colored.attr(style)
           ~~~~~~~~~~~~^^^^^^^
  File "C:\Python\Python313\Lib\site-packages\colored\colored.py", line 301, in attr
    return Colored(name).attribute()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "C:\Python\Python313\Lib\site-packages\colored\colored.py", line 99, in attribute
    self._utils.is_style_exist(self._name)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "C:\Python\Python313\Lib\site-packages\colored\utilities.py", line 66, in is_style_exist
    raise InvalidStyle(f'InvalidStyle: {name}')
colored.exceptions.InvalidStyle: InvalidStyle: underlined

dfrawleyCohga avatar Jun 18 '25 01:06 dfrawleyCohga

The issue is that printer/style.py has UND = styler.set_style('underline') in the GH repo here but UND = styler.set_style('underlined') (note the extra 'd') in pypi which must now be invalid in the colored package.

dfrawleyCohga avatar Jun 18 '25 04:06 dfrawleyCohga

This should be fixed, as I uploaded a new version on pypi.

gnebbia avatar Jun 21 '25 22:06 gnebbia