I get below error get:
Traceback (most recent call last):
File "/usr/local/bin/elastalert-test-rule", line 9, in <module>
load_entry_point('elastalert==0.0.88', 'console_scripts', 'elastalert-test-rule')()
File "/usr/local/lib/python2.7/dist-packages/elastalert-0.0.88-py2.7.egg/elastalert/test_rule.py", line 287, in main
test_instance.run_rule_test()
File "/usr/local/lib/python2.7/dist-packages/elastalert-0.0.88-py2.7.egg/elastalert/test_rule.py", line 269, in run_rule_test
rule_yaml = yaml.load(fh)
File "build/bdist.linux-x86_64/egg/yaml/__init__.py", line 71, in load
File "build/bdist.linux-x86_64/egg/yaml/constructor.py", line 37, in get_single_data
File "build/bdist.linux-x86_64/egg/yaml/composer.py", line 39, in get_single_node
File "build/bdist.linux-x86_64/egg/yaml/parser.py", line 98, in check_event
File "build/bdist.linux-x86_64/egg/yaml/parser.py", line 174, in parse_document_start
yaml.parser.ParserError: expected '<document start>', but found '<block mapping start>'
in "example_rules/example_frequency.yaml", line 20, column 1
Content in example_rules/example_frequency.yaml is:
es_host: localhost
es_port: 9200
name: Ravi
type: frequency
index: logstash-*
num_events: 50
timeframe:
hours: 4
filter:
- term:
country: "India1"
alert:
- "email"
email:
- "ravi.pandey#paytm.com"
Related
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
import pywhatkit as pwt
number=input("Enter the number: ")
msg=input("Msg: ")
pwt.sendwhatmsg_instantly(number,msg)
And then I got this error:
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in
start(fakepyfile,mainpyfile)
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
exec(open(mainpyfile).read(), main.dict)
File "", line 1, in
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/pywhatkit/init.py", line 16, in
from pywhatkit.whats import (
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/pywhatkit/whats.py", line 7, in import pyautogui as pg
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/pyautogui/init.py", line 249, in
import mouseinfo
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/mouseinfo/init.py", line 223, in
_display = Display(os.environ['DISPLAY'])
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/os.py", line 679, in getitem
raise KeyError(key) from None
KeyError: 'DISPLAY'
[Program finished]
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 pyTwistyScrambler import scrambler333
scrambler333.get_WCA_scramble()
Result:-
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pyTwistyScrambler\__init__.py", line 8, in trimmed_func
return func(*args, **kwargs).strip()
File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pyTwistyScrambler\scrambler333.py", line 8, in get_WCA_scramble
return _333_SCRAMBLER.call("scramble_333.getRandomScramble")
File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\execjs\_abstract_runtime_context.py", line 37, in call
return self._call(name, *args)
File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\execjs\_external_runtime.py", line 92, in _call
return self._eval("{identifier}.apply(this, {args})".format(identifier=identifier, args=args))
File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\execjs\_external_runtime.py", line 78, in _eval
return self.exec_(code)
File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\execjs\_abstract_runtime_context.py", line 18, in exec_
return self._exec_(source)
File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\execjs\_external_runtime.py", line 88, in _exec_
return self._extract_result(output)
File "C:\Users\ASUS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\execjs\_external_runtime.py", line 167, in _extract_result
raise ProgramError(value)
execjs._exceptions.ProgramError: SyntaxError: Expected identifier, string or number
I want to make a Rubiks cube scrambler but this module is not working, please help
I am very new to the python and I have been playing around with Panda dataframes, but when I use a groupby, I am not longer able to iterate over the dataframes using the labels.
Can some help me ?
newDF=df[df['Currency'].str.contains(currency)&df['Description'].str.contains('fx')]
newDF=newDF.rename(index=str, columns={ "Paid": "Withdrawn"})
moneyWithdrawnByUserDF=pd.DataFrame(newDF.groupby(['FirstName'])[['Withdrawn']].sum())
for index,row in moneyWithdrawnByUserDF.iterrows():
print row['FirstName']
The output/error I got is below :
Index([u'Email', u'FirstName', u'LastName', u'Owed', u'Withdrawn', u'UserId',
Traceback (most recent call last):
File "main.py", line 416, in <module>
sys.exit(main(sys.argv[1:]))
File "main.py", line 412, in main
parseGroups()
u'Category', u'Description', u'Id', u'Currency', u'Cost', u'Details',
u'GroupId'],
dtype='object')
File "main.py", line 45, in parseGroups
parseGroup(group)
File "main.py", line 81, in parseGroup processCurrencies(df)
File "main.py", line 95, in processCurrencies processCurrency(df, currency)
File "main.py", line 105, in processCurrency moneyWithdrawnByUserDF=calculateMoneyWithdrawnByUser(df, currency)
File "main.py", line 319, in calculateMoneyWithdrawnByUser
print row['FirstName']
File "/usr/local/lib/python2.7/site-packages/pandas/core/series.py", line 601, in __getitem__
result = self.index.get_value(self, key)
File "/usr/local/lib/python2.7/site-packages/pandas/core/indexes/base.py", line 2491, in get_value
raise e1
KeyError: 'FirstName'
Thank you
I think you need change:
moneyWithdrawnByUserDF=pd.DataFrame(newDF.groupby(['FirstName'])[['Withdrawn']].sum())
by reset_index:
moneyWithdrawnByUserDF= newDF.groupby(['FirstName'])['Withdrawn'].sum().reset_index()
Or parameter as_index=False for DataFrame:
moneyWithdrawnByUserDF= newDF.groupby(['FirstName'], as_index=False)['Withdrawn'].sum()