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

  • Home
  • SEARCH
  • 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 9182483
In Process

The Archive Base Latest Questions

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

I am trying to bypass this error: ItemNotFoundError: insufficient items with name u’No_Thanks’ error

  • 0

I am trying to bypass this error: ItemNotFoundError: insufficient items with name u'No_Thanks' error by using try..except statement. However, I am getting another error saying: NameError: name 'ItemNotFoundError' is not defined. I am not sure why is this happening. Thanks. Here is the code that I am using

br = mechanize.Browser()
br.addheaders = [('User-agent', 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1;Trident/5.0)')]
urls = "http://shop.o2.co.uk/mobile_phone/pay_monthly/init/Samsung/Galaxy_Ace_Purple"
r = br.open(urls)
page_child = br.response().read()
soup_child = BeautifulSoup(page_child)
contracts = [tag_c['value']for tag_c in soup_child.findAll('input', {"name": "tariff-duration"})]
data_usage = [tag_c['value']for tag_c in soup_child.findAll('input', {"name": "allowance"})]

for contract in contracts:
    if contract <>"Pay_and_Go":
        for data in data_usage:
            br.select_form('formDuration')
            br.form['tariff-duration']=[contract,]
            try:
                br.form['allowance']=[data,]
            except ItemNotFoundError:
                continue
            br.submit()
            page_child_child = br.response().read()
            soup_child_child = BeautifulSoup(page_child_child)
            items = soup_child_child.findAll('div', {"class": "n-pay-today"})  
  • 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-17T18:34:14+00:00Added an answer on June 17, 2026 at 6:34 pm

    I’m guessing the exception is defined by mechanize. Try: except mechanize.ItemNotFoundError


    It appears that this is correct after installing mechanize:

    >>> import mechanize
    >>> print mechanize.ItemNotFoundError
    <class 'mechanize._form.ItemNotFoundError'>
    >>> print mechanize.__version__
    (0, 2, 5, None, None)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I trying to make recursive function but I get this error: not all code
I am trying to asynchronously resolve an IP address to host name using C#
I am trying to let GoogleBot login to my website and bypass the authentication.
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
Trying to figure out how I can do this properly. The print_r looks like
Trying to copy the msdn refernce here doesn't work and gives an error I
trying to figure out why this is happening - I have an input text
I am trying to fix this for about 5 days and no luck, every
I'm trying to make simple view generator and using DRY principle, I don't want
How can I convert this Perl code to Groovy? How to bypass confirmation prompts

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.