Results 1 to 2 of 2

Thread: [Python] Mechanize module 'open' attribute doesn't work

  1. #1
    Join Date
    Sep 2008
    Beans
    148

    [Python] Mechanize module 'open' attribute doesn't work

    Code:
    >>> from mechanize import Browser
    >>> Browser.open("http://google.com")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: unbound method open() must be called with Browser instance as first argument (got str instance instead)
    What does this mean and how do I get it to work?
    thanks.

  2. #2
    Join Date
    Feb 2007
    Beans
    4,045
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: [Python] Mechanize module 'open' attribute doesn't work

    It means you must run open on an instance, not the class. Do help(Browser) to see what arguments the constructor needs, then create an instance
    Code:
    b= Browser(...)
    b.open("...")

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •