Hi
I am trying to spawn an snmptrap from python but i keep getting the following error
Invalid version specified after -v flag: 2c -c public 192.168.2.162 SNMPv2-SMI::enterprises.3.1.1
here is the python code i am using
from subprocess import Popen
Popen(['snmptrap', '-v 2c -c public 192.168.2.162 SNMPv2-SMI::enterprises.3.1.1'])
When i test the same command from the shell like this it works
snmptrap -v 2c -c public 192.168.2.162 SNMPv2-SMI::enterprises.3.1.1
I tried to close the space between v and 2c so its like this -v2c but i still get the error.
I will appreciate it very much if you can help me correct this or point out to me what i am doing wrong.
Thanks
Kaf
---------- Post updated at 06:32 PM ---------- Previous update was at 03:29 PM ----------
I got this to work and this is the code i used
import subprocess
from subprocess import Popen, PIPE
path = "-v 2c -c public 192.168.2.162 '' SNMPv2-SMI::enterprises.3.1.1"
Popen(['/opt/csw/bin/snmptrap', '%s' % path], shell=True, stdout=PIPE, stderr=subprocess.STDOUT)
If anyone else has a better way of doing this i will appreciate if you can share with me
Thanks