0
votes

I have written the following code, for some reason its giving an error when the code is applied, not sure what the issue is.

import datetime
now = datetime.datetime.now()
eventRootOids = ('1.3.6.1.4.1.11.2.17.19.2.2.%s')

EVENT_TRAP_VARBINDS = {
                'ApplicationId'      : tuple(['ApplicationId'] + [oid % 1 for oid in eventRootOids]),
                 Console'        : tuple(['Console'] + [oid% 2 for oid in eventRootOids]),
                       }

My ROOT OID is supposed to be 1.3.61.4.1.44.2.17.19.2.2.1/2/3 so on..)

TypeError: not all arguments converted during string formatting
                'ApplicationId'      : tuple(['ApplicationId'] + [oid % 1 for oid in eventRootOids]),
1

1 Answers

0
votes

you were missing a comma in eventRootOids = ('1.3.6.1.4.1.11.2.17.19.2.2.%s'); the way you wrote it it was not a tuple.

import datetime

now = datetime.datetime.now()

eventRootOids = ('1.3.6.1.4.1.11.2.17.19.2.2.%s', )

EVENT_TRAP_VARBINDS = { 'ApplicationId' : 
    tuple(['ApplicationId'] + [oid % 1 for oid in eventRootOids]), 
    'Console' : tuple(['Console'] + [oid % 2 for oid in eventRootOids]), }

print(EVENT_TRAP_VARBINDS)

output:

{'ApplicationId': 
    ('ApplicationId', '1.3.6.1.4.1.11.2.17.19.2.2.1'),
    'Console': ('Console', '1.3.6.1.4.1.11.2.17.19.2.2.2')
}