0

I'm using twint package and i'm trying to get user's posts, and until now I succeeded, but for some reason today it stopped working because of the following error:

 (ValueError("time data '2021-07-02 08:55:46 ???? ??? ???????' does not match format '%Y-%m-%d %H:%M:%S %Z'"), '<USERNAME>') hasn't posted yet..

My Query:

try:
    c = twint.Config()
    c.Username = user_name
    c.Custom["tweet"] = ["id"]
    c.Custom["user"] = ["bio"]
    c.Limit = vars.LIMIT
    c.Lang = 'en'
    c.Pandas = True
    c.Since = f'{vars.TODAY} 00:00:00'
    c.Until = f'{vars.TODAY} 23:59:59'
    twint.run.Search(c)
    Tweets_df = twint.storage.panda.Tweets_df
    return Tweets_df
except Exception as e:
    print(f"{e, user_name} hasn't posted yet..")

Can any one please help me? Thank you !

  • Welcome to Stack Overflow! Could you move the code from the `try`-`except` block, run it again and post the full error traceback in your question? – Sergey Shubin Jul 02 '21 at 09:29
  • Ty, I removed the try and except but still the same error is appearing.. There is no change in error appearance. – Tomer Shein Jul 02 '21 at 10:36
  • It is rather strange as the current exception look is given by the `print(f"{e, user_name} hasn't posted yet..")` statement inside the `except` block. Is it _completely_ the same? Does it have multiple lines in it? – Sergey Shubin Jul 02 '21 at 11:22
  • No. It just like a warning instead of except. The warning is coming from telegram bot package and the warning said exactly the same as exception. – Tomer Shein Jul 02 '21 at 11:34
  • Well, that's something. Could you add this warning to the question then? – Sergey Shubin Jul 02 '21 at 11:37
  • The Warning: __main__ - WARNING - Update "{'message': {'message_id': 2464, 'entities': [], 'new_chat_members': [], 'channel_chat_created': False, 'delete_chat_photo': False, 'caption_entities': [], 'photo': [], 'chat': {'id': XXXXXXXXXXX, 'type': 'private'}, 'group_chat_created': False, 'supergroup_chat_created': False, 'from': {'first_name': 'Tom', 'id': XXXXXXX, 'is_bot': False, 'last_name': 'Bal', 'language_code': 'en'}}, 'update_id': XXXXX}" caused error "time data '2021-07-02 08:55:46 ???? ??? ???????' does not match format '%Y-%m-%d %H:%M:%S %Z'" – Tomer Shein Jul 02 '21 at 13:07
  • When removing the bot the error is ---> 'raise ValueError("time data %r does not match format %r" % ValueError: time data '2021-07-02 15:00:02 ???? ??? ???????' does not match format '%Y-%m-%d %H:%M:%S %Z' ' – Tomer Shein Jul 02 '21 at 13:11

0 Answers0