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 7920771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:20:24+00:00 2026-06-03T16:20:24+00:00

Every time the program terminates when it runs the third time through this loop:

  • 0

Every time the program terminates when it runs the third time through this loop:

for component_ID in self.component_IDs:
    print component_ID
    fundamentals(component_ID)

This is my fundamentals class:

class fundamentals(download):

    def __init__(self, ID):
        self.browser = spynner.Browser()
        self.url = self.getURL(ID)
        self.browser.load(self.url)
        html = self.browser.html
        print "1"
        soup = BeautifulSoup(html)
        print "2"
        self.count = self.get_count(soup)
        self.currency = self.get_currency(soup)
        self.fundamentals = self.get_fundamentals_pages(soup)
        self.write_fundamentals_to_db(id, self.currency, self.count, 
                                      self.fundamentals)

The program always stops when soup = Beautiful(Soup) is executed the 3rd time. This doesn’t depend on which component_ID is provided.

component_ID has a length of 30 and when I start the loop at index 2 it also runs two times and stops at the 3rd run.

How does such strange behavior happen and how can I prevent it the next time?

More info:
Additionally the program just terminates without an error-message after printing 1 for the 3rd time. I am not sure what to do now.

When I only implement the .close(), but call the loop as above, it stops after going through the loop once. When I save the instance in the attribute self.component_ID the loop breaks after looping twice.

EDIT: I solved the previous version of this question by closing the spynner.browser and changing how the loop works. Instead of just calling the class I build a list and appended the instances to it.

  • 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-03T16:20:26+00:00Added an answer on June 3, 2026 at 4:20 pm

    Close the spynner.browser and change the way the loop works. Instead of just calling the class, build a list and appended the instances to it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Every time my program runs vs adds the default configuration to my app.config file.
I need to start a program every time the user logs in, but I
Every time I write a program of the form below using LINQ to SQL,
I wish to retrieve a unique number every time I start my program (from
I am writing a program that contains a JButton . Every time the button
I am writing a program that allows multiple users the share screenshots. Every time
Why following program every time prints I'm string and not I'm object. or I'm
How can I make a loop that can take user input every time it
Here is the story. I was doing a program, every time the program is
I want to run a batch script every time before starting program for debugging.

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.