With running the weighted deppWalk implementation I faced with below error. I edit the source code based on issue1 and issu2 and issue3; but, problem still exist. How can I solve that? Is there any other library for weighted deepWalk in python?
Traceback (most recent call last):
File "/usr/local/bin/deepwalk", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/deepwalk/__main__.py", line 145, in main
process(args)
File "/usr/local/lib/python3.7/dist-packages/deepwalk/__main__.py", line 73, in process
walks = weighted_random_walk.random_walk(G, num_paths=args.number_walks,path_length=args.walk_length, alpha=0)
File "/usr/local/lib/python3.7/dist-packages/deepwalk/weighted_random_walk.py", line 45, in random_walk
sentence = [nodes[tmp] for tmp in indexList]
File "/usr/local/lib/python3.7/dist-packages/deepwalk/weighted_random_walk.py", line 45, in <listcomp>
sentence = [nodes[tmp] for tmp in indexList]
File "/usr/local/lib/python3.7/dist-packages/networkx/classes/reportviews.py", line 193, in __getitem__
return self._nodes[n]
KeyError: 0
i have a error in pysnmp:caused by <class 'IndexError'>: pop from empty list
I am confused. I didn't do anything,But sometimes my code doesn't work
but sometimes
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "../conpot/protocols/snmp/conpot_cmdrsp.py", line 170, in handleMgmtOperation
rspVarBinds = self.proxy.getRequest(snmp_version, oid, **user_info)
File "../conpot/protocols/snmp/snmp_proxy.py", line 65, in getRequest
ObjectIdentity(*args)
File "/usr/local/lib/python3.6/site-packages/pysnmp/entity/rfc3413/oneliner/cmdgen.py", line 183, in getCmd
**kwargs):
File "/usr/local/lib/python3.6/site-packages/pysnmp/hlapi/asyncore/sync/cmdgen.py", line 113, in getCmd
snmpEngine.transportDispatcher.runDispatcher()
File "/usr/local/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 50, in runDispatcher
raise PySnmpError('poll error: %s' % ';'.join(format_exception(*exc_info())))
pysnmp.error.PySnmpError: poll error: Traceback (most recent call last):
; File "/usr/local/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 46, in runDispatcher
use_poll=True, map=self.__sockMap, count=1)
; File "/usr/lib64/python3.6/asyncore.py", line 207, in loop
poll_fun(timeout, map)
; File "/usr/lib64/python3.6/asyncore.py", line 188, in poll2
readwrite(obj, flags)
; File "/usr/lib64/python3.6/asyncore.py", line 123, in readwrite
obj.handle_error()
; File "/usr/lib64/python3.6/asyncore.py", line 110, in readwrite
obj.handle_write_event()
; File "/usr/lib64/python3.6/asyncore.py", line 442, in handle_write_event
self.handle_write()
; File "/usr/local/lib/python3.6/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 142, in handle_write
outgoingMessage, transportAddress = self.__outQueue.pop()
;IndexError: pop from empty list
caused by <class 'IndexError'>: pop from empty list
Code:
from mcpi_e.minecraft import Minecraft
mc = Minecraft.create('127.0.0.1', 4711)
pos = mc.player.getPos()
When trying to get coordinates.
mc.player.getPos()
an error pops up
Error:
Traceback (most recent call last):
File "C:\Users\merka\Desktop\pyt minecraft\buy.py", line 23, in <module>
pos = mc.player.getPos()
File "C:\Users\merka\AppData\Local\Programs\Python\Python39\lib\site-packages\mcpi_e\minecraft.py", line 230, in getPos
return CmdPositioner.getPos(self, self.playerId)
File "C:\Users\merka\AppData\Local\Programs\Python\Python39\lib\site-packages\mcpi_e\minecraft.py", line 50, in getPos
s = self.conn.sendReceive(self.pkg + b".getPos", id)
File "C:\Users\merka\AppData\Local\Programs\Python\Python39\lib\site-packages\mcpi_e\connection.py", line 103, in sendReceive
return self.receive()
File "C:\Users\merka\AppData\Local\Programs\Python\Python39\lib\site-packages\mcpi_e\connection.py", line 97, in receive
raise RequestError("%s failed"%self.lastSent.strip())
mcpi_e.connection.RequestError: b'entity.getPos()' failed
Process finished with exit code 1
what can be done?
mc = Minecraft.create('127.0.0.1', 4711, "merka")
I should have added a nickname
I am trying to make an SNMP agent following this tutorial:
http://www.nealc.com/blog/blog/2013/02/23/writing-an-snmp-agent-with-a-custom-mib-using-pysnmp/
I am using the exact code in the tutorial, but when I run the code it ends in this:
DBG: [19:13:54.964]: file SNMPv2-SMI.pyc mtime 1379957443
DBG: [19:13:54.964]: file SNMPv2-SMI.py mtime 1402947591
DBG: [19:13:54.965]: loadModules: evaluating /usr/local/lib/python2.7/dist-packages/pysnmp/smi/mibs/SNMPv2-SMI.py
Traceback (most recent call last):
File "snmpAgentTest.py", line 163, in <module>
agent = SNMPAgent(objects)
File "snmpAgentTest.py", line 59, in __init__
self._snmpEngine = engine.SnmpEngine()
File "/usr/local/lib/python2.7/dist-packages/pysnmp/entity/engine.py", line 18, in __init__
self.msgAndPduDsp = MsgAndPduDispatcher()
File "/usr/local/lib/python2.7/dist-packages/pysnmp/proto/rfc3412.py", line 24, in __init__
'SNMP-TARGET-MIB', 'SNMP-USER-BASED-SM-MIB'
File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 259, in loadModules
'MIB module \"%s\" load error: %s' % (modPath, traceback.format_exception(*sys.exc_info()))
pysnmp.smi.error.SmiError: MIB module "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/mibs/SNMPv2
-MIB.pyc" load error: ['Traceback (most recent call last):\n', ' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 255, in loadModules\n exec(modData, g)\n', ' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/mibs/SNMPv2-MIB.py", line 10, in <module>\n ( Module
Compliance, NotificationGroup, ObjectGroup, ) = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup")\n', ' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 299, in importSymbols\n self.loadModules(modName, **userCtx)\n', ' File
"/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 259, in loadModules\n \'MIB module \\"%s\\" load error: %s\' % (modPath, traceback.format_exception(*sys.exc_info()))\n', 'SmiError: MIB module "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/mibs/SNMPv2-CONF.pyc" load error: [\'Traceback (most recent call last):\\n\', \' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 255, in loadModules\\n exec(modData, g)\\n\', \' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/mibs/SNMPv2-CONF.py", line 2, in <module>\\n MibNode, = mibBuilder.importSymbols(\\\'SNMPv2-SMI\\\', \\\'MibNode\\\')\\n\', \' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 299, in importSymbols\\n self.loadModules(modName, **userCtx)\\n\', \' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 259, in loadModules\\n \\\'MIB module \\\\"%s\\\\" load error: %s\\\' % (modPath, traceback.format_exception(*sys.exc_info()))\\n\', \'SmiError: MIB module "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/mibs/SNMPv2-SMI.py" load error: [\\\'Traceback (most recent call last):\\\\n\\\', \\\' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 255, in loadModules\\\\n exec(modData, g)\\\\n\\\', \\\' File "<string>", line 2\\\\n\\\', \\\' -- WinAgents MIB Extraction Wizard\\\\n\\\', \\\' ^\\\\n\\\', \\\'SyntaxError: invalid syntax\\\\n\\\']\\n\']\n']
The MY-MIB.py that gets generated by build-pysnmp-mib looks like this:
# PySNMP SMI module. Autogenerated from smidump -f python MY-MIB
# by libsmi2pysnmp-0.1.3 at Thu Jun 26 19:03:31 2014,
# Python version sys.version_info(major=2, minor=7, micro=3, releaselevel='final', serial=0)
# Imports
( Integer, ObjectIdentifier, OctetString, ) = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
( ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint")
( Bits, Integer32, Integer32, MibIdentifier, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, enterprises, ) = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Integer32", "Integer32", "MibIdentifier", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "enterprises")
# Objects
myCompany = MibIdentifier((1, 3, 6, 1, 4, 1, 42))
testCount = MibScalar((1, 3, 6, 1, 4, 1, 42, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: testCount.setDescription("A sample count of something.")
testDescription = MibScalar((1, 3, 6, 1, 4, 1, 42, 2), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: testDescription.setDescription("A description of something")
# Augmentions
# Notifications
testTrap = NotificationType((1, 3, 6, 1, 4, 1, 42, 3)).setObjects(*() )
if mibBuilder.loadTexts: testTrap.setDescription("Test notification")
# Exports
# Objects
mibBuilder.exportSymbols("MY-MIB", myCompany=myCompany, testCount=testCount, testDescription=testDescription)
# Notifications
mibBuilder.exportSymbols("MY-MIB", testTrap=testTrap)
Does anyone have an idea what could have caused that exception? I've been on Google for the last few hours searching but didn't find anything valuable.
Edit: Also when using the code from http://pysnmp.sourceforge.net/examples/current/v3arch/agent/cmdrsp/v2c-custom-scalar-mib-objects.html I get a similar error:
Traceback (most recent call last):
File "agentTest2.py", line 8, in <module>
snmpEngine = engine.SnmpEngine()
File "/usr/local/lib/python2.7/dist-packages/pysnmp/entity/engine.py", line 18, in __init__
self.msgAndPduDsp = MsgAndPduDispatcher()
File "/usr/local/lib/python2.7/dist-packages/pysnmp/proto/rfc3412.py", line 24, in __init__
'SNMP-TARGET-MIB', 'SNMP-USER-BASED-SM-MIB'
File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 259, in loadModules
'MIB module \"%s\" load error: %s' % (modPath, traceback.format_exception(*sys.exc_info()))
pysnmp.smi.error.SmiError: MIB module "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/mibs/SNMPv2-MIB.pyc" load error: ['Traceback (most recent call last):\n', ' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 255, in loadModules\n exec(modData, g)\n', ' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/mibs/SNMPv2-MIB.py", line 10, in <module>\n ( ModuleCompliance, NotificationGroup, ObjectGroup, ) = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup")\n', ' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 299, in importSymbols\n self.loadModules(modName, **userCtx)\n', ' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 259, in loadModules\n \'MIB module \\"%s\\" load error: %s\' % (modPath, traceback.format_exception(*sys.exc_info()))\n', 'SmiError: MIB module "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/mibs/SNMPv2-CONF.pyc" load error: [\'Traceback (most recent call last):\\n\', \' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 255, in loadModules\\n exec(modData, g)\\n\', \' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/mibs/SNMPv2-CONF.py", line 2, in <module>\\n MibNode, = mibBuilder.importSymbols(\\\'SNMPv2-SMI\\\', \\\'MibNode\\\')\\n\', \' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 299, in importSymbols\\n self.loadModules(modName, **userCtx)\\n\', \' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 259, in loadModules\\n \\\'MIB module \\\\"%s\\\\" load error: %s\\\' % (modPath, traceback.format_exception(*sys.exc_info()))\\n\', \'SmiError: MIB module "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/mibs/SNMPv2-SMI.py" load error: [\\\'Traceback (most recent call last):\\\\n\\\', \\\' File "/usr/local/lib/python2.7/dist-packages/pysnmp/smi/builder.py", line 255, in loadModules\\\\n exec(modData, g)\\\\n\\\', \\\' File "<string>", line 2\\\\n\\\', \\\' -- WinAgents MIB Extraction Wizard\\\\n\\\', \\\' ^\\\\n\\\', \\\'SyntaxError: invalid syntax\\\\n\\\']\\n\']\n']