Skip to content
Advertisement

AttributeError: ‘Catalog’ object has no attribute ‘component’

I got this code written

But I get always error which says: AttributeError: ‘Catalog’ object has no attribute ‘component’. the problem is that I cannot see where is the problem. Is there something wrong (maybe indentation?). Thanks

Here is snippet where it finds error

Full error code

 Traceback (most recent call last)
  File "C:/Users/lukasz.karasinski/Adobe CC 2020/Adobe CC 2020/Photoshop/main.py", line 186, in <module>
    catalog.export_to_sql()
  File "C:/Users/lukasz.karasinski/Adobe CC 2020/Adobe CC 2020/Photoshop/main.py", line 90, in export_to_sql
    self.export_suites_to_sql(sql_file)
  File "C:/Users/lukasz.karasinski/Adobe CC 2020/Adobe CC 2020/Photoshop/main.py", line 107, in export_suites_to_sql
    suite_guid, suite.catalog_manufacturer_guid)
  File "C:/Users/lukasz.karasinski/Adobe CC 2020/Adobe CC 2020/Photoshop/main.py", line 110, in export_components_to_sql
    for key, component in self.component.items():
AttributeError: 'Catalog' object has no attribute 'component'

Advertisement

Answer

The trace back shows you the issue.

for key, component in self.component.items():

In this line self refers to Catalog class and as the error tells you it doesnt have any attribute called component. In your init method you define an attribute called components

class Catalog:
    def __init__(self):
        self.file_signatures = {}
        self.components = {}

So likley you have made a typo and should change

for key, component in self.component.items():

to

for key, component in self.components.items():

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement