title: getting output using pysnmp
body: <p>Forgive me if this is such a simple thing but I am new to Python, pysnmp and SNMP.</p>
  
  <p>I am trying to run some very simple queries using SNMP to get configuration information from a device and for some reason following the documentation <a href="http://pysnmp.sourceforge.net/docs/pysnmp-hlapi-tutorial.html#making-snmp-query" rel="nofollow">here</a>.</p>
  
  <p>I am not getting any output even though I can walk the SNMP via snmpwalk and googling seems to just show the example I have below.</p>
  
  <p>my code is</p>
  
  <pre><code>#!/usr/bin/python3.5
  
  from pysnmp.hlapi import *
  
  varCommunity = "public"
  varServer = "demo.snmplabs.com"
  varPort = 161
  
  g = getCmd(SnmpEngine(),
         CommunityData(varCommunity),
         UdpTransportTarget((varServer, varPort)),
         ContextData(),
         ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysName', 0)))
  
  next(g)
  </code></pre>
  
  <p>If I add</p>
  
  <pre><code>print(g)
  </code></pre>
  
  <p>I would get the following output</p>
  
  <pre><code>&lt;generator object getCmd at 0x7f25964847d8&gt;
  </code></pre>