From: Joern E. <Joe...@mi...> - 2001-07-30 13:44:34
|
Hi again > I've attached the log-file, the script and my version of string.py (please see attached file.zip) ... ... but obviously I cannot send any kind of files through a mailing-list. For anybody who's interested here the files as stated: The script # ---------- start of script import java java.lang.System.getProperty("python.home") java.lang.System.getProperty("python.path") import sys sys.path.append("c:\\program files\\jython") sys.path.append("c:\\program files\\jython\\lib") print "python.home: ",java.lang.System.getProperty("python.home") print "python.path: ",java.lang.System.getProperty("python.path") print "sys.path: ",sys.path print "sys.prefix: ",sys.prefix # Import support for strings import string # Get the value of the scalar node value = scriptinterface.getNodeValue(".1.3.6.1.4...") # Convert value to INT valueAsInt=string.atoi(value) #valueAsInt=eval(value) # Add 1 to value valueAsInt=valueAsInt+1 # Set a limit of 8 for value if valueAsInt > 8: valueAsInt=1 # Convert valueAsInt back to string value=str(valueAsInt) # Write back (increased) value to node scriptinterface.updateValue(".1.3.6.1.4...",value,"CONST") # ---------- end of script The log-file: Time stamp :Mon Jul 30 11:15:58 GMT+02:00 2001 The command executed : python.home: None python.path: None sys.path: ['.\\jars\\Lib', 'c:\\program files\\jython', 'c:\\program files\\jython\\lib'] sys.prefix: .\jars\ Traceback (innermost last): File "D:\AdventNet\simulator\mibs\_behavior_scripts_\counter_with_import.py", line 17, in ? File "C:\Program Files\Jython\Lib\string.py", line 418, in ? java.lang.NoSuchMethodError at string$py.f$0(C:\Program Files\Jython\Lib\string.py) at string$py.call_function(C:\Program Files\Jython\Lib\string.py) at org.python.core.PyTableCode.call(PyTableCode.java:155) at org.python.core.imp.createFromCode(imp.java:150) at org.python.core.imp.createFromPyClass(imp.java:70) at org.python.core.imp.loadFromPath(imp.java:283) at org.python.core.imp.loadFromPath(imp.java:227) at org.python.core.imp.load(imp.java:343) at org.python.core.imp.load(imp.java:362) at org.python.core.imp.importName(imp.java:417) at org.python.core.imp.importName(imp.java:444) at org.python.core.imp.importOne(imp.java:448) at org.python.pycode._pyx0.f$0(D:\AdventNet\simulator\mibs\_behavior_script s_\counter_with_import.py) at org.python.pycode._pyx0.call_function(D:\AdventNet\simulator\mibs\_behav ior_scripts_\counter_with_import.py) at org.python.core.PyTableCode.call(PyTableCode.java:155) at org.python.core.Py.runCode(Py.java:937) at org.python.core.__builtin__.execfile(__builtin__.java:273) at org.python.core.__builtin__.execfile(__builtin__.java:277) at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:131) at com.adventnet.snmp.simulator.agent.PyInterpreter.executeScript(PyInterpr eter.java:253) at com.adventnet.snmp.simulator.agent.XMLHandler.processScalarScript(XM LHandler.java:2089) at com.adventnet.snmp.simulator.agent.XMLHandler.processGetRequest(XMLHandl er.java:420) at com.adventnet.snmp.simulator.agent.RegObject.processGetRequest(RegObject .java:604) at com.adventnet.snmp.simulator.agent.RegObject.getRequest(RegObject.java:364) at com.adventnet.snmp.snmp2.agent.VarBindRequestListenerHolder.processGetVa rBinds(VarBindRequestListenerHolder.java:736) at com.adventnet.snmp.snmp2.agent.PduRequestHandler.processGetReqMesg(PduRe questHandler.java:775) Exception while executing the Python Script at com.adventnet.snmp.snmp2.agent.PduRequestHandler.getRequest(PduRequestHa ndler.java:682) at com.adventnet.snmp.snmp2.agent.PduRequestHandler.processSnmpPduRequest(P duRequestHandler.java:335) at com.adventnet.snmp.snmp2.agent.SnmpAgent.callback(SnmpAgent.java:770) at com.adventnet.snmp.snmp2.SnmpSession.processPacket(SnmpSession.java: 2342) at com.adventnet.snmp.snmp2.SnmpCallback.processPacket(SnmpCallback.java:240) at com.adventnet.snmp.snmp2.SnmpCallback.run(SnmpCallback.java:119) java.lang.NoSuchMethodError: java.lang.NoSuchMethodError python.home: None python.path: None sys.path: ['.\\jars\\Lib', 'c:\\program files\\jython', 'c:\\program files\\jython\\lib', 'c:\\program files\\jython', 'c:\\program files\\jython\\lib'] sys.prefix: .\jars\ python.home: None python.path: None sys.path: ['.\\jars\\Lib', 'c:\\program files\\jython', 'c:\\program files\\jython\\lib', 'c:\\program files\\jython', 'c:\\program files\\jython\\lib', 'c:\\program files\\jython', 'c:\\program files\\jython\\lib'] sys.prefix: .\jars\ The concerned lines from string.py: ... # Try importing optional built-in module "strop" -- if it exists, # it redefines some string operations that are 100-1000 times faster. # It also defines values for whitespace, lowercase and uppercase # that match <ctype.h>'s definitions. try: # the following line is no. 418 from strop import maketrans, lowercase, uppercase, whitespace letters = lowercase + uppercase except ImportError: pass # Use the original versions |