From a68ce8658ab0908227dc486e73d02060e21174f8 Mon Sep 17 00:00:00 2001 From: Harmon Date: Fri, 10 Feb 2023 18:10:20 -0600 Subject: [PATCH] Handle incorrect processing state for errored chunked uploads --- tweepy/api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tweepy/api.py b/tweepy/api.py index 5279c74..3d755c8 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -3684,7 +3684,11 @@ class API: media = self.chunked_upload_finalize(media_id, **kwargs) if wait_for_async_finalize and hasattr(media, 'processing_info'): - while media.processing_info['state'] in ('pending', 'in_progress'): + while ( + media.processing_info['state'] in ( + 'pending', 'in_progress' + ) and 'error' not in media.processing_info + ): time.sleep(media.processing_info['check_after_secs']) media = self.get_media_upload_status(media.media_id, **kwargs) -- 2.25.1