Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9145715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:34:59+00:00 2026-06-17T10:34:59+00:00

I have been struggling with this error for a while now and there seems

  • 0

I have been struggling with this error for a while now and there seems to be different opinions regarding why the interpreter complains about the ‘continue’. So I would like to provide the erroneous code below.

import tweepy
import time
def writeHandlesToFile():
    file = open("dataFile.txt","w")
    try:
        list = tweepy.Cursor(tweepy.api.followers,screen_name='someHandle',).items(100000)
        print "cursor executed"
        for item in list:
            file.write(item.screen_name+"\n")
    except tweepy.error.TweepError as e:
        print "In the except method"
        print e
        time.sleep(3600)
        continue

The reason I am particular on including the continue at the end is because I would like for the program to restart execution at the top from where it left off after the sleep in order to preserve the program state. I need the sleep in order to abide by the twitter api rate limits wherein the api only allows you to make a certain number of requests every hour.
So anyone who might see my mistake naive or otherwise please do point it out or please provide me with an alternative implementation without the use of the continue statement.

BTW I do not have tabs and spaces mixed as was suggested in another post.
Thank you for your help in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:35:00+00:00Added an answer on June 17, 2026 at 10:35 am

    continue is only allowed within a for or while loop. You can easily restructure your function to loop until a valid request.

    def writeHandlesToFile():
        while True:
            with open("dataFile.txt","w") as f:
                try:
                    lst = tweepy.Cursor(tweepy.api.followers,screen_name='someHandle',).items(100000)
                    print "cursor executed"
                    for item in lst:
                        f.write(item.screen_name+"\n")
                    break
                except tweepy.error.TweepError as e:
                    print "In the except method"
                    print e
                    time.sleep(3600)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been struggling with this for a while now. given a set of
Iv been struggling with this for a while now an I have exhausted all
I have been struggling with this error for 2 days now and i am
I have been struggling with this error for more than two hours: error: aggregate
I have been struggling with this question for awhile now, and I haven't reached
I have been struggling with this for a while and could really use some
I have reviewed about 20 plus pages on the web regarding this error. I
I have been struggling with this issue for hours now. I currently have a
I've been struggling with this for a while now. I am using Microsoft.Office.Interop.Excel and
So I have been struggling with an issue for a while now and seem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.