OwenCochell / cursepy

A CurseForge API written in python
MIT License
7 stars 1 forks source link

Error setting addon, possibly related to logo. #14

Open TwigGlenn4 opened 1 year ago

TwigGlenn4 commented 1 year ago

This particular minecraft mod Hostile Neural Networks produces an error when it is created. Code copied and tested from Advik-B's issue because their program let me find this issue.

from cursepy import CurseClient
from v import api_key

c = CurseClient(api_key)
game = c.game(432) # Minecraft
addon = c.addon(552574) # Hostile Neural Networks

My error is as follows and seems to imply it could be related to the mod's logo data.

Traceback (most recent call last):
  File "/home/twigglenn4/Downloads/curseTest/test.py", line 6, in <module>
    addon = c.addon(552574) # Hostile Neural Networks
  File "/home/twigglenn4/Downloads/curseTest/cursepy/wrapper.py", line 124, in addon
    return self.handle(5, addon_id)
  File "/home/twigglenn4/Downloads/curseTest/cursepy/handlers/base.py", line 990, in handle
    inst = hand.handle(*args, **kwargs)
  File "/home/twigglenn4/Downloads/curseTest/cursepy/handlers/base.py", line 411, in handle
    return super().handle()
  File "/home/twigglenn4/Downloads/curseTest/cursepy/handlers/base.py", line 190, in handle
    data = self.format(raw_data)
  File "/home/twigglenn4/Downloads/curseTest/cursepy/handlers/metacf.py", line 316, in format
    logo = base.CurseAttachment(logoa['title'], logoa['id'], logoa['thumbnailUrl'] if 'thumbnailUrl' in logoa.keys() else logoa['thumbnailurl'], logoa['url'], True, data['id'], logoa['description'])
TypeError: 'NoneType' object is not subscriptable
OwenCochell commented 1 year ago

Thanks for reporting this!

The issue was the addon you were trying to work with did not have a logo, as you suggested. If this is the case, then cursepy will skip that part when loading the addon. This should be fixed in the latest version of cursepy, the version you want is 2.2.0. Please let me know if any more issues arise, but otherwise we can close this issue.

Thanks!