Bee-Mar / mmpm

MagicMirror Package Manager
MIT License
198 stars 30 forks source link

BUG: Initializing MagicMirror 3rd party packages database Traceback (most recent call last) produces an error #146

Closed rcberg3 closed 10 months ago

rcberg3 commented 11 months ago

Describe the Bug

Getting an error when searching or installing mopdules.

Is this an issue with the CLI or GUI? CLI

Is this something that should be put in the Wiki? maybe? seems to be a repeat, see 2 years ago: https://github.com/Bee-Mar/mmpm/issues/68

To Reproduce Steps to reproduce the behavior:

  1. A fresh install of raspbian, MagicMirror, and mmpm.
  2. In terminal, search or install a module, for example: mmpm search mbta or mmpm install MMM-MBTA
  3. Terminal gives the following response:
    mmpm install MMM-MBTA
    + Initializing MagicMirror 3rd party packages database Traceback (most recent call last):
    File "/home/pi/.local/bin/mmpm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
    File "/home/pi/.local/lib/python3.11/site-packages/mmpm/entrypoint.py", line 12, in main
    _main_(args)
    File "/home/pi/.local/lib/python3.11/site-packages/mmpm/mmpm.py", line 51, in main
    packages: Dict[str, List[MagicMirrorPackage]] = mmpm.core.load_packages(force_refresh=should_refresh)
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/pi/.local/lib/python3.11/site-packages/mmpm/core.py", line 1054, in load_packages
    packages = retrieve_packages()
               ^^^^^^^^^^^^^^^^^^^
    File "/home/pi/.local/lib/python3.11/site-packages/mmpm/core.py", line 1135, in retrieve_packages
    categories: list = [category.contents[-1].contents[0] for category in categories_soup][2:]
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/pi/.local/lib/python3.11/site-packages/mmpm/core.py", line 1135, in <listcomp>
    categories: list = [category.contents[-1].contents[0] for category in categories_soup][2:]
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3/dist-packages/bs4/element.py", line 980, in __getattr__
    raise AttributeError(
    AttributeError: 'NavigableString' object has no attribute 'contents'

Operating System, Python3 Version, and Web Browser\ (Please complete the following information)

MMPM Environment Settings

mmpm log --zip
 + Initializing MagicMirror 3rd party packages database Traceback (most recent call last):
  File "/home/pi/.local/bin/mmpm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/pi/.local/lib/python3.11/site-packages/mmpm/entrypoint.py", line 12, in main
    _main_(args)
  File "/home/pi/.local/lib/python3.11/site-packages/mmpm/mmpm.py", line 51, in main
    packages: Dict[str, List[MagicMirrorPackage]] = mmpm.core.load_packages(force_refresh=should_refresh)
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/.local/lib/python3.11/site-packages/mmpm/core.py", line 1054, in load_packages
    packages = retrieve_packages()
               ^^^^^^^^^^^^^^^^^^^
  File "/home/pi/.local/lib/python3.11/site-packages/mmpm/core.py", line 1135, in retrieve_packages
    categories: list = [category.contents[-1].contents[0] for category in categories_soup][2:]
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/.local/lib/python3.11/site-packages/mmpm/core.py", line 1135, in <listcomp>
    categories: list = [category.contents[-1].contents[0] for category in categories_soup][2:]
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/bs4/element.py", line 980, in __getattr__
    raise AttributeError(
AttributeError: 'NavigableString' object has no attribute 'contents'
zerojarvis commented 11 months ago

I was able to revert LINE 1135 in the CORE.PY back to the previous commit line. And it works.

You can see my comment here. https://github.com/Bee-Mar/mmpm/commit/0228b2f24c6873cd01c4bcce7c08778a573537db?diff=split&w=0#diff-61e91788176d3558cdf2905aa7c4c116179863f8fabb9a00463ac30f021c3254R1135

Bee-Mar commented 11 months ago

@zerojarvis I'm currently in the midst of a total rework of the application and have put off fixing bugs to get it out ASAP. If you'd like to make a PR, please feel free. If interested, take a look at the code-cleanup branch which is vastly different from the current

slugmuffin commented 11 months ago

thank you @zerojarvis - that helped

Bee-Mar commented 10 months ago

@zerojarvis @slugmuffin @rcberg3 has been released. This is a complete rework of the application with improvements and stability all-around. Please see How to Migrate to 4.x.x as well the rest of the pages in the Wiki