joaoricardo000 / whatsapp-bot-seed

A small python framework to create a whatsapp bot, with regex-callback message routing.
727 stars 245 forks source link

While in group and recieve a message, crash #55

Closed K4CZP3R closed 8 years ago

K4CZP3R commented 8 years ago

Hi, When I add my bot to group and I send normal text message it throws this: http://pastebin.com/tuY7geWC.

How can i fix this?

ghost commented 8 years ago

You have to go to /usr/lib/python2.7/ and open the file asyncore.py In the file, find the line 199 and change def loop(timeout=30.0, use_poll=False, map=None, count=None): to def loop(timeout=30.0, use_poll=True, map=None , count=None):

K4CZP3R commented 8 years ago

No, it doesn't work

alafanechere commented 8 years ago

It fixed the issue for me for the Bad file descriptor But then I have an AssertionError:msg:

File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/axolotl/layer.py", line 270, in handleWhisperMessage
    encMessageProtocolEntity = EncryptedMessageProtocolEntity.fromProtocolTreeNode(node)
  File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/axolotl/protocolentities/message_encrypted.py", line 53, in fromProtocolTreeNode
    encNode.data.encode('latin-1') if sys.version_info >= (3,0) else encNode.data)
  File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/axolotl/protocolentities/message_encrypted.py", line 24, in setEncProps
    assert encType in "pkmsg", "msg"
AssertionError: msg
K4CZP3R commented 8 years ago

@alafanechere so, for you groups messages doesn't work too??

K4CZP3R commented 8 years ago

I've found https://github.com/tgalal/yowsup/issues/898, this issue is about AsserationError: msg but I can't find solution. https://github.com/tgalal/yowsup/issues/931 this too

alafanechere commented 8 years ago

Yes I am in the same situation exactly. Its due apparently to a new group message encryption skmsg that yowsup seems to have some trouble to handle right now...

I am trying to edit the code to avoid the Assertion Error and ignore the message. Would be happy to hear from you if you succeed in solving this.

K4CZP3R commented 8 years ago

For @montemarcaldera are group messages working :o

K4CZP3R commented 8 years ago

I'm going to reinstall everything, and try it

K4CZP3R commented 8 years ago

Guys, IT W O R K S!

K4CZP3R commented 8 years ago

I just reinstalled my system and installed

sudo apt-get install python-dateutil sudo apt-get install python-setuptools sudo apt-get install python-dev sudo apt-get install libevent-dev sudo apt-get install ncurses-dev

git clone git://github.com/tgalal/yowsup.git

and this https://pypi.python.org/pypi/protobuf/2.6.1 and pycrypto

K4CZP3R commented 8 years ago

If you want help, cookiemonsterkg@o2.pl on Skype

alafanechere commented 8 years ago

Thanks it worked again for me with a bit of fine tuning. I still encounter crash when the bot receives several messages in a row:

AuthError("Unhandled stream:error node:\n%s" % node)
AuthError: Unhandled stream:error node:
<stream:error>
<xml-not-well-formed>
</xml-not-well-formed>
</stream:error>
ghost commented 8 years ago

@alafanechere #34

joaoricardo000 commented 8 years ago

@K4CZP3R @alafanechere Did you manage to reverse the problem? I had this issue in a random group, tried to reinstall and everything, but no success.. What exactly did you do? Thanks!

@montemarcaldera , merged PR. Sorry for taking so long...

ghost commented 8 years ago

For me, it works fine https://github.com/tgalal/yowsup/pull/1336

K4CZP3R commented 8 years ago

I'm doing everything on Raspberry Pi. I reinstalled OS and installed everything one more time but I didn't change environment to android

ghost commented 8 years ago

Well, Yowsup is ignoring my messages only via group chat.

AssertionError: msg

Edit: I tried to reinstall everything but it doesn't work :(

K4CZP3R commented 8 years ago

Did you changed environment? Dont do this ;)

e0xify commented 8 years ago

still crashing for me:

rror: (9, 'Bad file descriptor')
server.py [INFO][2016-03-15 15:58:42,092] Restarting..
server.py [INFO][2016-03-15 15:58:42,092] ################

server.py [INFO][2016-03-15 15:58:42,092] Server s 95864
server.py [INFO][2016-03-15 15:58:42,093] ################

server.py [ERROR][2016-03-15 15:58:42,093] Unexpected Exce Traceback (most recent call last):
File "src/server.py", line 38, in start
self.stack.loop(timeout=0.5, discrete=0.5)
File "build/bdist.linux-x86_64/egg/yowsup/stacks/yowstack.py", asyncore.loop(_args, *_kwargs)
File "/usr/lib/python2.7/asyncore.py", line 216, in loop
poll_fun(timeout, map)
File "/usr/lib/python2.7/asyncore.py", line 145, in poll
r, w, e = select.select(r, w, e, timeout)
error: (9, 'Bad file descriptor')
server.py [INFO][2016-03-15 15:58:42,093] Restarting..
server.py [INFO][2016-03-15 15:58:42,093] ################

^C

Traceback (most recent call last):
File "src/server.py", line 55, in
server.start()
File "src/server.py", line 35, in start
logging.info("#" * 50)
File "/usr/lib/python2.7/logging/init.py", line 1614, in i root.info(msg, _args, *_kwargs)
File "/usr/lib/python2.7/logging/init.py", line 1152, in i self.log(INFO, msg, args, **kwargs)
File "/usr/lib/python2.7/logging/init.py", line 1271, in
self.handle(record)
File "/usr/lib/python2.7/logging/init.py", line 1281, in h self.callHandlers(record)
File "/usr/lib/python2.7/logging/init.py", line 1321, in c hdlr.handle(record)
File "/usr/lib/python2.7/logging/init.py", line 749, in ha self.emit(record)
File "/usr/lib/python2.7/logging/init.py", line 872, in em stream.write(fs % msg)
KeyboardInterrupt

ghost commented 8 years ago

@e0xify You have to go to /usr/lib/python2.7/ and open the file asyncore.py In the file, find the line 199 and change def loop(timeout=30.0, use_poll=False, map=None, count=None): to def loop(timeout=30.0, use_poll=True, map=None, count=None):

ghost commented 8 years ago

@K4CZP3R Ok, i'll try

Edit: I'm still having AssertionError: msg

e0xify commented 8 years ago

Did this before but then i got another error something like child Attribute missing..

Will post the log tomorrow

joaoricardo000 commented 8 years ago

https://github.com/tgalal/yowsup/pull/1364/files fixed!

joaoricardo000 commented 8 years ago

Just added a Dockerfile, that includes all dependencies and also patches with the above correction. If you have already docker installed, it is the most easy and reliable way to run the bot.