[Grok-dev] grok 1.4 I can't import netsnmp

3sso takz1977 at gmail.com
Sun Jun 26 19:13:26 EDT 2011


Owen Shepherd say I can add 'netsnmp' to setup.py

I did it but still error

now I dont sure what real package name for it (maybe pysnmp)

at interpreter mode on ubuntu (run script on shell) it work with 

import snmp <<

sample code 

result = netsnmp.snmpget(oid + str(int(v)+i), Version=2,
DestHost="10.255.105.10", Community="public")

----------------------

the error is 

2011-06-27 05:53:57,011 WARNING [root] Developer mode is enabled: this is a
security risk and should NOT be enabled on production servers. Developer
mode can usually be turned off by setting the `devmode` option to `off` or
by removing it from the instance configuration file completely.
2011-06-27 05:53:57,587 WARNING [ZODB.blob] (9327) Blob dir
/home/takz/zte/var/blobstorage/ has insecure mode setting
Starting server in PID 9327.
serving on http://192.168.20.113:8080
192.168.20.48 - - [27/Jun/2011:05:54:15 +0700] "GET / HTTP/1.1" 401 46 "-"
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko)
Chrome/14.0.797.0 Safari/535.1"
192.168.20.48 - - [27/Jun/2011:05:54:21 +0700] "GET / HTTP/1.1" 303 0 "-"
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko)
Chrome/14.0.797.0 Safari/535.1"
192.168.20.48 - - [27/Jun/2011:05:54:21 +0700] "GET
/%2B%2Bgrokui%2B%2B/%40%40applications HTTP/1.1" 200 2445 "-" "Mozilla/5.0
(Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko)
Chrome/14.0.797.0 Safari/535.1"
2011-06-27 05:54:23,854 ERROR [SiteError]
http://192.168.20.113:8080/zte/@@index
Traceback (most recent call last):
  File
"/home/takz/.buildout/eggs/zope.publisher-3.12.6-py2.7.egg/zope/publisher/publish.py",
line 132, in publish
    result = publication.callObject(request, obj)
  File
"/home/takz/.buildout/eggs/grokcore.view-2.5-py2.7.egg/grokcore/view/publication.py",
line 56, in callObject
    return super(ZopePublicationSansProxy, self).callObject(request, ob)
  File
"/home/takz/.buildout/eggs/zope.app.publication-3.13.1-py2.7.egg/zope/app/publication/zopepublication.py",
line 207, in callObject
    return mapply(ob, request.getPositionalArguments(), request)
  File
"/home/takz/.buildout/eggs/zope.publisher-3.12.6-py2.7.egg/zope/publisher/publish.py",
line 107, in mapply
    return debug_call(obj, args)
  File
"/home/takz/.buildout/eggs/zope.publisher-3.12.6-py2.7.egg/zope/publisher/publish.py",
line 113, in debug_call
    return obj(*args)
  File
"/home/takz/.buildout/eggs/grokcore.view-2.5-py2.7.egg/grokcore/view/components.py",
line 139, in __call__
    return self._render_template()
  File
"/home/takz/.buildout/eggs/grokcore.view-2.5-py2.7.egg/grokcore/view/components.py",
line 143, in _render_template
    return self.template.render(self)
  File
"/home/takz/.buildout/eggs/grokcore.view-2.5-py2.7.egg/grokcore/view/components.py",
line 316, in render
    return template.pt_render(namespace)
  File
"/home/takz/.buildout/eggs/zope.pagetemplate-3.5.2-py2.7.egg/zope/pagetemplate/pagetemplate.py",
line 113, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations)()
  File
"/home/takz/.buildout/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py",
line 271, in __call__
    self.interpret(self.program)
  File
"/home/takz/.buildout/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py",
line 343, in interpret
    handlers[opcode](self, args)
  File
"/home/takz/.buildout/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py",
line 819, in do_loop_tal
    iterator = self.engine.setRepeat(name, expr)
  File
"/home/takz/.buildout/eggs/zope.tales-3.5.1-py2.7.egg/zope/tales/tales.py",
line 682, in setRepeat
    expr = self.evaluate(expr)
  File
"/home/takz/.buildout/eggs/zope.tales-3.5.1-py2.7.egg/zope/tales/tales.py",
line 696, in evaluate
    return expression(self)
  File
"/home/takz/.buildout/eggs/zope.tales-3.5.1-py2.7.egg/zope/tales/pythonexpr.py",
line 59, in __call__
    return eval(self._code, vars)
  File "<string>", line 1, in <module>
  File "/home/takz/zte/src/zte/app.py", line 14, in showstatall
    result = netsnmp.snmpget(oid + str(int(v)+i), Version=2,
DestHost="10.255.105.10", Community="public")
NameError: global name 'netsnmp' is not defined






Christian Klinger wrote:
> 
> Hi,
> 
> can you paste the traceback of the error you recive during startup?
> 
> Christian
>>
>> I need to build web-app for check my network device by snmp (oid)
>>
>> I try my script on shell command it ok (it need import netsnmp)
>>
>> but on Grok got error if import netsnmp in app.py
>>
>> (in my case cant start paster serve it show error about netsnmp module)
>>
>>
>> please help
>>
>> regard
> 
> 
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev
> 
> 

-- 
View this message in context: http://old.nabble.com/grok-1.4-I-can%27t-import-netsnmp-tp31927974p31933573.html
Sent from the Grok mailing list archive at Nabble.com.



More information about the Grok-dev mailing list