0

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]),
0

1 Answer 1

0

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')
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.