1. #1
    illfuuptn
    illfuuptn's Avatar Become A Pro!
    Join Date: 03-17-10
    Posts: 1,860

    Quick Python question

    When I put in
    Code:
    from mechanize import browser
    I get
    Code:
         Traceback (most recent call last):
      File "", line 1, in 
        from mechanize import browser
    ImportError: cannot import name browser
    what am I doing wrong?

  2. #2
    RickySteve
    SBR is a criminal organization
    RickySteve's Avatar Become A Pro!
    Join Date: 01-31-06
    Posts: 3,415
    Betpoints: 187

    You do realize this forum struggles greatly to only barely serve its own purpose, let alone technical coding discussion.

  3. #3
    JoeVig
    JoeVig's Avatar Become A Pro!
    Join Date: 01-11-08
    Posts: 772
    Betpoints: 37

    "And now for something completely different..."

    Oh, wrong Python.

  4. #4
    Salmon Steak
    Salmon Steak's Avatar Become A Pro!
    Join Date: 03-05-10
    Posts: 2,110
    Betpoints: 613

    the traceback is telling you what program file (pyshell#1) the error occured in, the line (1), and what line of code caused the error(from mechanize import browser). "Import error" is defining the reason, cannot import name browser. Don't know why. I am learning how to do python right now actually. If I read on how to help you more I will let you know. GL

  5. #5
    antifoil
    Update your status
    antifoil's Avatar Become A Pro!
    Join Date: 11-11-09
    Posts: 3,993
    Betpoints: 6611

    here is a pro tip.

    go to some programming forum, create a username like programminggirl or the like, and use a pink font. for an added bonus put some anime girl as your avatar and use <3s. next, tell them what your problem is, but be really detailed as to what you are looking for and how to program is to work.

    those nerds will do the work for you and give you the result.
    Nomination(s):
    This post was nominated 2 times . To view the nominated thread please click here. People who nominated: acarmelo1, and TheEditor

  6. #6
    bztips
    bztips's Avatar Become A Pro!
    Join Date: 06-03-10
    Posts: 283

    Try using "Browser" instead of "browser" -- python distinguishes upper/lower cases

  7. #7
    acarmelo1
    The Panamanian Connection
    acarmelo1's Avatar Become A Pro!
    Join Date: 09-29-09
    Posts: 6,321
    Betpoints: 1581

    Quote Originally Posted by antifoil View Post
    here is a pro tip.

    go to some programming forum, create a username like programminggirl or the like, and use a pink font. for an added bonus put some anime girl as your avatar and use <3s. next, tell them what your problem is, but be really detailed as to what you are looking for and how to program is to work.

    those nerds will do the work for you and give you the result.
    Best tip here so far <3

  8. #8
    uva3021
    uva3021's Avatar Become A Pro!
    Join Date: 03-01-07
    Posts: 537
    Betpoints: 381

    there is no function or class called browser in mechanize obv

  9. #9
    bztips
    bztips's Avatar Become A Pro!
    Join Date: 06-03-10
    Posts: 283

    Quote Originally Posted by uva3021 View Post
    there is no function or class called browser in mechanize obv
    No browser class, but there is a Browser class:

    http://wwwsearch.sourceforge.net/mechanize/

  10. #10
    uva3021
    uva3021's Avatar Become A Pro!
    Join Date: 03-01-07
    Posts: 537
    Betpoints: 381

    well then "Browser" is the answer, hopefully OP awards you handsomely, sir

Top