Python subprocess Popen
Question: Why its not working? :|

    
    
    import subprocess    
    p = subprocess.Popen([r"snmpget","-v","1","-c","public","-Oqv","","-Ln","192.168.1.1 1.3.6.1.2.1.2.2.1.10.7"],stdout=subprocess.PIPE).communicate()[0]
    print p
    

Run script:

    
    
    root@OpenWrt:~/python# python w.py
    
    root@OpenWrt:~/python# 
    

its printing empty line :| Bu on the same machine, from shell:

    
    
    root@OpenWrt:~/python# snmpget -v 1 -c public -Oqv -Ln 192.168.1.1 1.3.6.1.2.1.2.2.1.10.7
    3623120418
    

I know tere is "-Oqv","", but without it i got error from snmpget...


Answer: I see you have an empty string in your args:

    
    
    ... ,"-Oqv","","-Ln", ...
                ^^
    

Is that possibly causing a problem for snmpget?

You've got two arguments in one, too:

    
    
    "192.168.1.1 1.3.6.1.2.1.2.2.1.10.7"
    

That should be split in two:

    
    
    "192.168.1.1", "1.3.6.1.2.1.2.2.1.10.7"
    

When typing a command on the command line, the shell does this splitting for
you. When calling `subprocess.Popen()` in this way, you'll have to do _all_
the argument splitting yourself. You'd get the same error if you ran:

    
    
    snmpget -v 1 -c public -Oqv -Ln '192.168.1.1 1.3.6.1.2.1.2.2.1.10.7'
    

