[GH-ISSUE #132] IndexError: list index out of range #35

Closed
opened 2026-09-02 13:09:01 +02:00 by TheLovinator · 4 comments
Owner

Originally created by @hearhellacopters on GitHub (Jul 25, 2023).
Original GitHub issue: https://github.com/TheLovinator1/discord-twitter-webhooks/issues/132

Getting this error when I run the bot

Job "sched_func (trigger: interval[0:15:00], next run at: 2023-07-25 06:53:34 UTC)" raised an exception
Traceback (most recent call last):
  File "C:\Users\MediaCenter\AppData\Local\pypoetry\Cache\virtualenvs\discord-twitter-webhooks-RQC6o9-p-py3.11\Lib\site-packages\apscheduler\executors\base.py", line 125, in run_job
    retval = job.func(*job.args, **job.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\MediaCenter\Documents\discord_twitter\discord-twitter-webhooks\discord_twitter_webhooks\main.py", line 399, in sched_func
    send_to_discord(reader)
  File "C:\Users\MediaCenter\Documents\discord_twitter\discord-twitter-webhooks\discord_twitter_webhooks\send_to_discord.py", line 271, in send_to_discord
    if entry.published < the_oldest_tweet[-1].published:
                         ~~~~~~~~~~~~~~~~^^^^
IndexError: list index out of range
Originally created by @hearhellacopters on GitHub (Jul 25, 2023). Original GitHub issue: https://github.com/TheLovinator1/discord-twitter-webhooks/issues/132 Getting this error when I run the bot ``` Job "sched_func (trigger: interval[0:15:00], next run at: 2023-07-25 06:53:34 UTC)" raised an exception Traceback (most recent call last): File "C:\Users\MediaCenter\AppData\Local\pypoetry\Cache\virtualenvs\discord-twitter-webhooks-RQC6o9-p-py3.11\Lib\site-packages\apscheduler\executors\base.py", line 125, in run_job retval = job.func(*job.args, **job.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\MediaCenter\Documents\discord_twitter\discord-twitter-webhooks\discord_twitter_webhooks\main.py", line 399, in sched_func send_to_discord(reader) File "C:\Users\MediaCenter\Documents\discord_twitter\discord-twitter-webhooks\discord_twitter_webhooks\send_to_discord.py", line 271, in send_to_discord if entry.published < the_oldest_tweet[-1].published: ~~~~~~~~~~~~~~~~^^^^ IndexError: list index out of range ```
Author
Owner

@hearhellacopters commented on GitHub (Jul 25, 2023):

I think this has to do with a nitter end point not working. Changing to a different host seemed to work. Error code was a little unclear.

<!-- gh-comment-id:1649396713 --> @hearhellacopters commented on GitHub (Jul 25, 2023): I think this has to do with a nitter end point not working. Changing to a different host seemed to work. Error code was a little unclear.
Author
Owner

@TheLovinator1 commented on GitHub (Jul 25, 2023):

Hi, this should be fixed now.

I forgot to update the RSS feed before marking every entry as read. 🙃

<!-- gh-comment-id:1650308813 --> @TheLovinator1 commented on GitHub (Jul 25, 2023): Hi, this should be fixed now. I forgot to update the RSS feed before marking every entry as read. 🙃
Author
Owner

@hearhellacopters commented on GitHub (Jul 25, 2023):

After doing a pull and running poetry install I noticed a few updates

• Updating pydantic-core 2.4.0
• Updating pydantic 2.1.0

Now when I run the bot it crashes

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\MediaCenter\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\MediaCenter\Documents\discord_twitter\discord-twitter-webhooks\discord_twitter_webhooks\main.py", line 115, in <module>
    @app.post("/feed")
     ^^^^^^^^^^^^^^^^^
  File "C:\Users\MediaCenter\AppData\Local\pypoetry\Cache\virtualenvs\discord-twitter-webhooks-RQC6o9-p-py3.11\Lib\site-packages\fastapi\routing.py", line 706, in decorator
    self.add_api_route(
  File "C:\Users\MediaCenter\AppData\Local\pypoetry\Cache\virtualenvs\discord-twitter-webhooks-RQC6o9-p-py3.11\Lib\site-packages\fastapi\routing.py", line 645, in add_api_route
    route = route_class(
            ^^^^^^^^^^^^
  File "C:\Users\MediaCenter\AppData\Local\pypoetry\Cache\virtualenvs\discord-twitter-webhooks-RQC6o9-p-py3.11\Lib\site-packages\fastapi\routing.py", line 491, in __init__
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\MediaCenter\AppData\Local\pypoetry\Cache\virtualenvs\discord-twitter-webhooks-RQC6o9-p-py3.11\Lib\site-packages\fastapi\dependencies\utils.py", line 289, in get_dependant
    add_param_to_fields(field=param_field, dependant=dependant)
  File "C:\Users\MediaCenter\AppData\Local\pypoetry\Cache\virtualenvs\discord-twitter-webhooks-RQC6o9-p-py3.11\Lib\site-packages\fastapi\dependencies\utils.py", line 462, in add_param_to_fields
    if field_info.in_ == params.ParamTypes.path:
       ^^^^^^^^^^^^^^
AttributeError: 'FieldInfo' object has no attribute 'in_'

I reverted poetry.lock and the requirements.txt file and it's running again

<!-- gh-comment-id:1650335832 --> @hearhellacopters commented on GitHub (Jul 25, 2023): After doing a pull and running poetry install I noticed a few updates > • Updating pydantic-core 2.4.0 > • Updating pydantic 2.1.0 Now when I run the bot it crashes ``` Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\MediaCenter\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1204, in _gcd_import File "<frozen importlib._bootstrap>", line 1176, in _find_and_load File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 690, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 940, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "C:\Users\MediaCenter\Documents\discord_twitter\discord-twitter-webhooks\discord_twitter_webhooks\main.py", line 115, in <module> @app.post("/feed") ^^^^^^^^^^^^^^^^^ File "C:\Users\MediaCenter\AppData\Local\pypoetry\Cache\virtualenvs\discord-twitter-webhooks-RQC6o9-p-py3.11\Lib\site-packages\fastapi\routing.py", line 706, in decorator self.add_api_route( File "C:\Users\MediaCenter\AppData\Local\pypoetry\Cache\virtualenvs\discord-twitter-webhooks-RQC6o9-p-py3.11\Lib\site-packages\fastapi\routing.py", line 645, in add_api_route route = route_class( ^^^^^^^^^^^^ File "C:\Users\MediaCenter\AppData\Local\pypoetry\Cache\virtualenvs\discord-twitter-webhooks-RQC6o9-p-py3.11\Lib\site-packages\fastapi\routing.py", line 491, in __init__ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\MediaCenter\AppData\Local\pypoetry\Cache\virtualenvs\discord-twitter-webhooks-RQC6o9-p-py3.11\Lib\site-packages\fastapi\dependencies\utils.py", line 289, in get_dependant add_param_to_fields(field=param_field, dependant=dependant) File "C:\Users\MediaCenter\AppData\Local\pypoetry\Cache\virtualenvs\discord-twitter-webhooks-RQC6o9-p-py3.11\Lib\site-packages\fastapi\dependencies\utils.py", line 462, in add_param_to_fields if field_info.in_ == params.ParamTypes.path: ^^^^^^^^^^^^^^ AttributeError: 'FieldInfo' object has no attribute 'in_' ``` I reverted poetry.lock and the requirements.txt file and it's running again
Author
Owner

@TheLovinator1 commented on GitHub (Jul 25, 2023):

Thanks, I downgraded Pydantic to 2.0.3 and that seems to work.

https://github.com/tiangolo/fastapi/discussions/9709#discussioncomment-6543584 I guess we will have to wait for this before updating

<!-- gh-comment-id:1650347759 --> @TheLovinator1 commented on GitHub (Jul 25, 2023): Thanks, I downgraded Pydantic to 2.0.3 and that seems to work. https://github.com/tiangolo/fastapi/discussions/9709#discussioncomment-6543584 I guess we will have to wait for this before updating
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TheLovinator/discord-twitter-webhooks#35
No description provided.