Closed rigid closed 8 years ago
I get this when using EchoClient to echo an encrypted contact It tries several times and fails. Here is the log:
`DEBUG:yowsup.layers.logger.layer:rx:
WARNING:yowsup.layers.axolotl.layer:'ascii' codec can't decode byte 0xd7 in position 27: ordinal not in range(128) DEBUG:yowsup.layers.logger.layer:tx:
DEBUG:yowsup.layers.logger.layer:rx:
DEBUG:yowsup.layers.logger.layer:rx:
WARNING:yowsup.layers.axolotl.layer:'ascii' codec can't decode byte 0xd7 in position 27: ordinal not in range(128) DEBUG:yowsup.layers.logger.layer:tx:
DEBUG:yowsup.layers.logger.layer:rx:
DEBUG:yowsup.layers.logger.layer:rx:
�iԣ�/�������B���9�!3���� � � �C���_l�3��e4��N3ʕQ�t J�������حᱠGC�Z� ��?-�ϣ �ӹ\��k � q�([��F� 0��[�|rYʂ��CgL�+�8L�r�Pp�!w"��.N���d�����_��i������$-F�.��%�j�a60���J�~ݱu�w�ɵ�_l:����^s!S��s+C.b��_� ��&�y�ϛtz����:v+�[�O�9��Y ݽ�\�L�:W:�`��'��XM�F� =�1e�. ��~��D�6kɸ�K�%U��_Z.'���P��n�r�ҡ�\��ˀV_v"��f���c+f�o�Th^���20�^Ձ��u7��:�`kk�B���;�g�ll��9c�D([���[b��(fm��N�Wdsrv��$Y��Z���+��9�-�-�Ds ,��_����V�Z� C��`ρ�o�`tL���Y��3�U B0��"��CC��� X?��XY#N�C ��" �Dӊ��K���R���9iZ#�_9M� v� n7��H[!���$�Z{�!M�m`����S qb���r��}l���c1+鑚�B%��n{�5t#����v������T�6k��IqbgFm}�i�0Ƥ��K��<�6�����#L_2jn��" ˛)�K�f��z�l[�o�E }���m�7�v�5 8`��HR�f��N(�/��%F�gg#�?�d� -߲��N���ETq�8�zg�{��ퟨ��BD�Hz�"l9��wy�?�)�RN�/XW����t�t�%�5�2pO���KH�ċ��[J��,L�ђ�8E�2� 6�!9��P~�DN i2$�����~E�b/��'D�!�:Ԑkd���Q��=��N"/��2�� 't[�('����^j|���ȣ����5jCTg���U� �}$[�"�K g�,u���P(��Z'[�O��}/��w�h T;ؼ��h�xtj�.�Na�N�`���;��u`��q L���%�@s�fd�[^���z��l��CCZ�0O�N�e��ẁ��ݠ�N�h��xd]ce��'Y��dF����}��� ��ajXD�{��Rk����ܚ��Y�Y�6�2=�O�[���`������j�n_5���]����@�Yz�������G�,jcO�r/b���TQ���D���~G��⚀�/hg��"lv��J�'� ���h~�&ȫ|w'W�i��#5���j�\��D�y��6�?T����^>�5E����O~���_�
WARNING:yowsup.layers.axolotl.layer:'ascii' codec can't decode byte 0xd7 in position 27: ordinal not in range(128) DEBUG:yowsup.layers.logger.layer:tx:
DEBUG:yowsup.layers.logger.layer:rx:
DEBUG:yowsup.layers.logger.layer:rx:
WARNING:yowsup.layers.axolotl.layer:'ascii' codec can't decode byte 0xd7 in position 27: ordinal not in range(128) DEBUG:yowsup.layers.logger.layer:tx:
DEBUG:yowsup.layers.logger.layer:rx:
DEBUG:yowsup.layers.logger.layer:rx:
WARNING:yowsup.layers.axolotl.layer:'ascii' codec can't decode byte 0xd7 in position 27: ordinal not in range(128) DEBUG:yowsup.layers.logger.layer:tx:
DEBUG:yowsup.layers.logger.layer:rx:
DEBUG:yowsup.layers.logger.layer:rx:
^[[?62;9;cWARNING:yowsup.layers.axolotl.layer:'ascii' codec can't decode byte 0xd7 in position 27: ordinal not in range(128) WARNING:yowsup.layers.axolotl.layer:Too many retries!! Going to send the delivery receipt myself! DEBUG:yowsup.layers.logger.layer:tx:
`
same problem, no solution for now?
I figured out this happens when sender uses emojies. maybe this helps?
Similar to #40, I assume this is not an axolotl issue, but this exception is raised from your own code. It simply is the axolotl layer which prints the error. You could try/except
your receive function and print a stack trace when an error occurs.
I am not sure, but maybe some of the latest updates in axolotl changed the behaviour whether message body is unicode
or str
.
Simply retrieve it and check its type: if it's str
, then decode('utf-8')
it; however, if it's unicode, leave it as it came. (applying decode()
to a unicode
object will produce exactly the error as seen above)
@freelo does it mean, that this is not an axolotl problem?? I'm using transwhat for yowsup. so this should be forwarded to transwhat dev?
@freelo my code:
receipt = OutgoingReceiptProtocolEntity(messageProtocolEntity.getId(), messageProtocolEntity.getFrom())
antwort = output
self.toLower(receipt)
self.toLower(TextMessageProtocolEntity(antwort, to = messageProtocolEntity.getFrom()))
@bdbais Is this your complete message handler? (Where does output
come from? The error seems to be raised while handling an incoming message.)
Finally, try something like this:
def on_message(self,entity):
try:
(your message handler)
except Exception:
import traceback
print 'There is an error in my code at:'
traceback.print_exc()
raise
@thundergreen I had a look at transwhat and it indeed seems to call body.decode('utf-8')
unconditionally (see session.py:275 and utils.py:46 in current stv0g yowsup-2 branch). I don't really know the internals, so I cannot tell which part is 'wrong': yowsup or transwhat. What you see is just a (possibly temporary) incompatibility between those two versions.
@freelo thanks for your feedback. Will go back to the transwhat dev and check with him. Thanks so far
Thorsten Fröhlich Am 05.04.2016 19:23 schrieb "freelo" notifications@github.com:
@bdbais https://github.com/bdbais Is this your complete message handler? (Where does output come from? The error seems to be raised while handling an incoming message.)
Finally, try something like this:
def on_message(self,entity): try: (your message handler) except Exception: import traceback print 'There is an error in my code at:' traceback.print_exc() raise
@thundergreen https://github.com/thundergreen I had a look at transwhat and it indeed seems to call body.decode('utf-8') unconditionally (see session.py:275 and utils.py:46 in current stv0g yowsup-2 branch). I don't really know the internals, so I cannot tell which part is 'wrong': yowsup or transwhat. What you see is just a (possibly temporary) incompatibility between those two versions.
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/jlguardi/yowsup/issues/37#issuecomment-205907127
@thundergreen Before reporting here again, please, take some time to reproduce with yowsup-cli otherwise we can't try it.
Okay I isolated the problem, @freelo your code doesn't work on my handler, it's a warning no exception is raised.
Before update axolotl library I can send a message like "Hello folks! 'Say hi' to me"... now I must to remove ' and all accents from message.
I tried several method to "clean" and translate them but no one works:
`
output = "Hello, folks! 'Say!'"
print("Output: %s " % output )
if isinstance(output,basestring):
output.encode('utf8')
else:
unicode(output).encode('utf8')
output.encode('latin-1', 'replace')
output = unidecode(output)
output = output.replace(u'’', u"'")
`
at which line is the warning produced?
I'm trying this way:
if isinstance(output,basestring):
output.encode('utf8')
else:
unicode(output).encode('utf8')
output.encode('latin-1', 'replace')
output = unidecode(output)
output = output.replace(u'’', u"'")
self.lock.acquire()
try:
messageEntity = TextMessageProtocolEntity(output, to = Jid.normalize(cell))
self.ackQueue.append(messageEntity.getId())
self.toLower(messageEntity)
self.lock.release()
except Exception:
self.lock.release()
import traceback
print('There is an error in my code at:')
traceback.print_exc()
raise
@bdbais
try/except
around the suspicious statements. I'm sure it will help you understand the problem.# coding:utf-8
at the beginning of the file and then output = u'bääh'
. I hope this works in your environment as well (don't know basestring
). I have read comments saying the opposite, but in my environment I must not encode() the text (how should anyone know what encoding you were using? utf-8? latin-1? latin-15?).# -*- coding: utf-8 -*- already set.
I'm testing u"long message"
I now get tracebacks:
2016-04-08 21:09:07,340 WARNING yowsup.layers.axolotl.layer: No valid sessionsBad Mac!
2016-04-08 21:09:07,346 ERROR transwhat: Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/transWhat/transwhat.py", line 95, in <module>
asyncore.loop(timeout=1.0, count=10, use_poll = True)
File "/usr/lib/python2.7/asyncore.py", line 220, in loop
poll_fun(timeout, map)
File "/usr/lib/python2.7/asyncore.py", line 201, in poll2
readwrite(obj, flags)
File "/usr/lib/python2.7/asyncore.py", line 123, in readwrite
obj.handle_error()
File "/usr/lib/python2.7/asyncore.py", line 108, in readwrite
obj.handle_read_event()
File "/usr/lib/python2.7/asyncore.py", line 449, in handle_read_event
self.handle_read()
File "/usr/lib/python2.7/site-packages/yowsup/layers/network/layer.py", line 102, in handle_read
self.receive(data)
File "/usr/lib/python2.7/site-packages/yowsup/layers/network/layer.py", line 110, in receive
self.toUpper(data)
File "/usr/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 75, in toUpper
self.__upper.receive(data)
File "/usr/lib/python2.7/site-packages/yowsup/layers/stanzaregulator/layer.py", line 29, in receive
self.processReceived()
File "/usr/lib/python2.7/site-packages/yowsup/layers/stanzaregulator/layer.py", line 52, in processReceived
self.processReceived()
File "/usr/lib/python2.7/site-packages/yowsup/layers/stanzaregulator/layer.py", line 49, in processReceived
self.toUpper(oneMessageData)
File "/usr/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 75, in toUpper
self.__upper.receive(data)
File "/usr/lib/python2.7/site-packages/yowsup/layers/auth/layer_crypt.py", line 65, in receive
self.toUpper(payload)
File "/usr/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 75, in toUpper
File "/usr/lib/python2.7/asyncore.py", line 449, in handle_read_event
self.handle_read()
File "/usr/lib/python2.7/site-packages/yowsup/layers/network/layer.py", line 102, in handle_read
self.receive(data)
File "/usr/lib/python2.7/site-packages/yowsup/layers/network/layer.py", line 110, in receive
self.toUpper(data)
File "/usr/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 75, in toUpper
self.__upper.receive(data)
File "/usr/lib/python2.7/site-packages/yowsup/layers/stanzaregulator/layer.py", line 29, in receive
self.processReceived()
File "/usr/lib/python2.7/site-packages/yowsup/layers/stanzaregulator/layer.py", line 52, in processReceived
self.processReceived()
File "/usr/lib/python2.7/site-packages/yowsup/layers/stanzaregulator/layer.py", line 49, in processReceived
self.toUpper(oneMessageData)
File "/usr/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 75, in toUpper
self.__upper.receive(data)
File "/usr/lib/python2.7/site-packages/yowsup/layers/auth/layer_crypt.py", line 65, in receive
self.toUpper(payload)
File "/usr/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 75, in toUpper
self.__upper.receive(data)
File "/usr/lib/python2.7/site-packages/yowsup/layers/coder/layer.py", line 35, in receive
self.toUpper(node)
File "/usr/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 75, in toUpper
self.__upper.receive(data)
File "/usr/lib/python2.7/site-packages/yowsup/layers/axolotl/layer.py", line 136, in receive
self.onMessage(protocolTreeNode)
File "/usr/lib/python2.7/site-packages/yowsup/layers/axolotl/layer.py", line 158, in onMessage
self.handleEncMessage(protocolTreeNode)
File "/usr/lib/python2.7/site-packages/yowsup/layers/axolotl/layer.py", line 269, in handleEncMessage
self.retry(node)
AttributeError: 'UpdatedYowAxolotlLayer' object has no attribute 'retry'
Just pull latest version.
As said @freelo, fixed with #56 and already merged to master.
indeed, thank you
with commit 1765197c9fa57d8 and axolotl-0.1.34, I get lots of these:
WARNING yowsup.layers.axolotl.layer: 'ascii' codec can't encode character u'\xf6' in position 1: ordinal not in range(128)
There is no additional information and messages that throw this warning, are not delivered.