I`ve obtain this error
  File "/class.py", line 246, in __init__
if d and self.rf == 2 and d["descriptionType"] in ["900000000000003001"] and d["conceptId"] in konZer.zerrenda:
TypeError: 'Desk' object is not subscriptable
I created this object
class Desk:
     descriptionId = ""
     descriptionStatus = ""
     conceptId = ""
     term = ""
And I called it in another class
class DescriptionList():
     def deskJ(self,line):
         er = line.strip().split('\t')
         desc = Desk()
         if er[1] == "0":
            desc.descriptionId = er[0]
            desc.descriptionStatus = er[1]
            desc.conceptId = er[2]
            desc.term = er[3]
         return description
Then I called the function "deskJ" at init and I get the error at this part (I've deleted some parts of the function):
def __init__(self,fitx,konZer,lanZer={}):
        with codecs.open(fitx,encoding='utf-8') as fitx:
            lines = fitx.read().split('\n')[1:-1]
            for line in lines:
                d = self.deskJ(line)
                if d and self.rf == 2 and d["descriptionType"] in ["900000000000003001"] and d["conceptId"] in konZer.zerrenda:
                    c = konZer.zerrenda[d["conceptId"]]
                    c["fullySpecifiedName"] = d["term"]
What am I doing wrong?
Using d["descriptionType"] is trying to access d with the key "descriptionType".  That doesn't work, though, because d is a Desk object that doesn't have keys.  Instead, get the attributes:
if d and self.rf == 2 and d.descriptionType in ["900000000000003001"] and d.conceptId in konZer.zerrenda:
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With