Skip to content

'NoneType' object has no attribute 'address' maybe when symbol_link is missing #64

@hsl38

Description

@hsl38

Hi

I am using the XCPsim.a2l file that comes with CANape of Vector. I tried the "getting started with pyA2L" code with the file. I had 'NoneType' object has no attribute 'address' error. In the hope of locating the cause, I change the code a bit.

for m in measurements:
    try:
        print(f'{'':8} {m.name:48} {m.datatype:12} {m.ecu_address.address:08x} {m.symbol_link_id:4}')
    except Exception as e:
        # print(f'{m.name:48} {m.datatype:12} {m.symbol_link_id:12}', end=' ')
        print(f'{'ERROR':8} {m.name:48} {m.datatype:12} {'':16}Exception: {e}')

The output is as following. It seems to me that the errors occur when symbol_link is missing.

         BitSlice                                         UWORD        001be05c    1
         BitSlice0                                        UWORD        001be05c    2
         BitSlice1                                        UWORD        001be05c    3
         BitSlice2                                        UWORD        001be05d    4
         Counter_B4                                       UBYTE        001bdcb3    6
         Counter_B5                                       UBYTE        001bdcb3    7
         Counter_B6                                       UBYTE        001bdcb3    8
         Counter_B7                                       UBYTE        001bdcb3    9
ERROR    DtChannel1                                       FLOAT32_IEEE                 Exception: 'NoneType' object has no attribute 'address'
         FW1                                              UBYTE        001c00ab   13
         KL1Output                                        UBYTE        001bddd2   23
ERROR    MaxChannel1                                      FLOAT32_IEEE                 Exception: 'NoneType' object has no attribute 'address'
ERROR    MinChannel1                                      FLOAT32_IEEE                 Exception: 'NoneType' object has no attribute 'address'
         PWM                                              UBYTE        001bdddf   31
         PWMFiltered                                      UBYTE        001bdde2   32
         PWM_Level                                        SBYTE        001c00a2   33

--- deleted ---

         byteCounter                                      UBYTE        001bdcb3 1072
         bytePWMFilter                                    UBYTE        001c00a3 1073
         channel1                                         FLOAT32_IEEE 001bd004 1075
         channel2                                         FLOAT32_IEEE 001bd008 1076
         channel3                                         FLOAT32_IEEE 001bd00c 1077
         channel_d                                        FLOAT64_IEEE 001bd028 1078
         counter1000msSignal                              FLOAT64_IEEE 001bd0c8 1079
         counter100msSignal                               FLOAT64_IEEE 001bd0c0 1080
         counter10msSignal                                FLOAT64_IEEE 001bd0b8 1081
         doubleTestParam01                                FLOAT64_IEEE 001bd0d0 1082
         doubleTestParam01_mea                            FLOAT64_IEEE 001bd0d0 1083

I am not sure if it is ok to attach the XCPsim.a2l here. I will try to explain what I found instead.

Searching the a2l file for "DtChannel1" (the 1st error) gave me 4 matches. Two found in MEASUREMENT definition, one in COMPU_METHOD definition, one in GROUP Virtual definition. There was no SYMBOL_LINK property in any of the definitions.

I wish I could fix it myself. Can somebody fix it, please?

My environment

Python: 3.12.5
pyA2L: latest version from pip
OS: Windows 11

Make your day

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions