TypeError: 'NoneType' object has no attribute '__getitem__'

12 views
Skip to first unread message

A. Gonzalez

unread,
Oct 11, 2021, 8:25:19 AMOct 11
to Bots Open Source EDI Translator
Hello everyone!

I am having a little problem getting part of a field.

With this line I get the error "MessageError: [F20]: Record "000-119" field "119-18" too big (max 20):"
       loux.put({'BOTSID':'119','119-18':nadxx.get({'BOTSID':'NAD'},{'BOTSID':'CTA','3139':'CN','C056.3412':None})})

And when I want to take from position 1 to 20
        loux.put({'BOTSID':'119','119-18':nadxx.get({'BOTSID':'NAD'},{'BOTSID':'CTA','3139':'CN','C056.3412':None})[1:20]})
I get the following error:
loux.put({'BOTSID':'119','119-18': nadxx.get({'BOTSID':'CTA','3139':'CN','C056.3412':None})[0:20]}) TypeError: 'NoneType' object has no attribute '__getitem__'
 
Does anyone have any idea how to fix it?

Thanks in Advance!!!

Best Regards
Antonio

A. Gonzalez

unread,
Oct 11, 2021, 8:43:35 AMOct 11
to Bots Open Source EDI Translator
OK friends!!!

I found the solution in an old post!

I used:
        CTACN = nadxx.get({'BOTSID':'NAD'},{'BOTSID':'CTA','3139':'CN','C056.3412':None})
        if CTACN:
            CTACN=CTACN[0:20]
        loux.put({'BOTSID':'119','119-18':CTACN})

And now works fine!

I searched 100 times in the group before opening the post....

Best Regards!!

Antonio
Reply all
Reply to author
Forward
0 new messages