Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError: length must be positive integer, got 0 #126

Closed
andri1 opened this issue Apr 19, 2017 · 0 comments
Closed

AssertionError: length must be positive integer, got 0 #126

andri1 opened this issue Apr 19, 2017 · 0 comments

Comments

@andri1
Copy link

andri1 commented Apr 19, 2017

cant get the "Getting last messages sent" example work

`import fbchat

client = fbchat.Client("my fb ID", "pass")

friends = client.getUsers("my friend's name")
friend = friends[0]

last_messages = client.getThreadInfo(friend.uid,0)
last_messages.reverse() # messages come in reversed order

for message in last_messages:
print(message.body)
`
got this:

Logging in...

<!DOCTYPE html><html lang="fr" id="facebook" class="no_js"><head><meta charset="utf-8" / (.....) a long html body (.....) /script>
https://www.facebook.com/?seq=0&__req=3\n
Login successful
Traceback (most recent call last):
File "fbchatExample.py", line 8, in
last_messages = client.getThreadInfo(friend.uid,0)
File "C:\Program Files\python\2.7.13\lib\site-packages\fbchat\client.py", line
583, in getThreadInfo
assert last_n > 0, 'length must be positive integer, got %d' % last_n
AssertionError: length must be positive integer, got 0

D:>

have already updated via pip and installed last version of python 2.7, 2.7.13

I have problem with the echobot example too,
got this:

Login successful
Listening...
Received [{u'made': u'1492603113638', u'type': u'qprimer'}]
Received [{u'fbid': u'', u'type': u'deltaflow', u'sequencer': u'15944'}, {u'queue': L, u'ofd_ts': 1492603208789L, u'iseq': 15944, u'type': u'delta', u'delta': {u'irisSeqId': u'15944', u'actionTimestamp': u'1492603208646', u'watermarkTimestamp': u'1492600304313', u'class': u'MarkRead', u'threadKeys': [{u'otherUserFbId': u'<my friend's facebook ID>'}]}}]
Unknown type {u'fbid': u'', u'type': u'deltaflow', u'sequencer': u'15944'}
Received [{u'queue': L, u'ofd_ts': 1492603213397L, u'iseq': 15945, u'type': u'delta', u'delta': {u'folders': [u'FOLDER_INBOX'], u'irisSeqId': u'15945', u'class': u'MarkFolderSeen', u'timestamp': u'1492603223321'}}]
Received [{u'seen_timestamp': 1492603223321L, u'recent_unread': 2, u'unseen': 0, u'type': u'inbox', u'unread': 100, u'realtime_viewer_fbid': L}, {u'seen_timestamp': 1492603213000L, u'recent_unread': 2, u'unseen': 0, u'type': u'inbox', u'unread': 100, u'realtime_viewer_fbid': L}]
Received [{u'queue': L, u'ofd_ts': 1492603312379L, u'iseq': 15946, u'type': u'delta', u'delta': {u'body': u'my sent message test', u'irisSeqId': u'15946', u'class': u'NewMessage', u'attachments': [], u'messageMetadata': {u'tags': [u'source:titan:m_basic'], u'actorFbId': u'', u'messageId': u'mid.$cAAAABlV5Sghht1xg6lbhhcYDjwY_', u'offlineThreadingId': u'6260432042531423807', u'timestamp': u'1492603312362', u'threadKey': {u'otherUserFbId': u'<my friend's facebook ID>'}}}}]
<my facebook ID> said: my sent message test
Received [{u'queue': L, u'ofd_ts': 1492603316823L, u'iseq': 15947, u'type': u'delta', u'delta': {u'folders': [u'FOLDER_INBOX'], u'irisSeqId': u'15947', u'class': u'MarkFolderSeen', u'timestamp': u'1492603326743'}}]
Received [{u'seen_timestamp': 1492603326743L, u'recent_unread': 2, u'unseen': 0, u'type': u'inbox', u'unread': 100, u'realtime_viewer_fbid': L}, {u'seen_timestamp': 1492603317000L, u'recent_unread': 2, u'unseen': 0, u'type': u'inbox', u'unread': 100, u'realtime_viewer_fbid': L}]

I can see my sent message,
the message "my sent message test" is my sent message
but I dont know how to avoid these long debug log (if debug log they are, sorry Im have no big expertise in python yet)
when arrived, the response by the friend appears too.

I have combine these two problems in one issue because I think they are in relation..
any suggestions??

@madsmtm madsmtm mentioned this issue May 5, 2017
carpedm20 added a commit that referenced this issue May 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant