Python - TypeError: not all arguments converted during string formatting -
i have written following code, reason giving error when code applied, not sure issue is.
import datetime = 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 oid in eventrootoids]), console' : tuple(['console'] + [oid% 2 oid in eventrootoids]), }
my root oid supposed 1.3.61.4.1.44.2.17.19.2.2.1/2/3
on..)
typeerror: not arguments converted during string formatting 'applicationid' : tuple(['applicationid'] + [oid % 1 oid in eventrootoids]),
you missing comma in eventrootoids = ('1.3.6.1.4.1.11.2.17.19.2.2.%s')
; way wrote it not tuple.
import datetime = 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 oid in eventrootoids]), 'console' : tuple(['console'] + [oid % 2 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') }
Comments
Post a Comment