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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:56:16+00:00 2026-05-30T00:56:16+00:00

I just starting looking at the Python version of Mechanize today. I took most

  • 0

I just starting looking at the Python version of Mechanize today. I took most of this code from the first example on http://wwwsearch.sourceforge.net/mechanize/. The documentation of this module is very sparse and I have no idea how to debug this.

I am trying to find and follow the first link with the text “Careers”. When I run this I get this error “mechanize._mechanize.LinkNotFoundError”. Can anyone tell me what I am doing wrong?

import re
import mechanize

br = mechanize.Browser(factory=mechanize.RobustFactory())
br.open("http://www.amazon.com/")

response1 = br.follow_link(text_regex=r"Careers", nr=1)
assert br.viewing_html()
print br.title()
  • 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-05-30T00:56:19+00:00Added an answer on May 30, 2026 at 12:56 am

    I just tried the sample code myself, and it looks like the problem is with the nr argument. It’s not documented anywhere but in the source code (which is far more informative than the documentation!), and it states that:

    nr: matches the nth link that matches all other criteria (default 0)

    Because the nr argument is 0-based, when you gave the argument of 1, it was looking for the second mention of Careers, which was obviously nothing.

    Because it defaults to 0, or the first link found, you can set the nr argument to 0, or leave it off entirely.

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

Sidebar

Related Questions

This is a strange request but I'm looking for buggy Python code. I want
This is a newbie theory question - I'm just starting to use Python and
I'm just starting to get into generating code from a DSL using visual studio
I'm just starting to design some embedded devices, and am looking for resources. What
Just starting to explore the 'wonders' of regex. Being someone who learns from trial
Im just starting a project and since this project is personal I was wondering
Im just starting with localization today and need some information. I have a project
I just completed my first (minor) Python project, and my boss wants me to
I've just starting looking at a site in place at work. They're using Elmah
I am just starting to learn about spring and was looking at the difference

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.