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

The Archive Base Latest Questions

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

I am new to python (done some java in the past). I recently decided

  • 0

I am new to python (done some java in the past). I recently decided to automate a process that takes me about 20 hours once a year. I need to login to a vendor’s website, with a login form they have. That then loads a new form which I can select an order from, and then it loads yet another form I can submit an item number to. This then loads the page with sizes of the item and price per size, I take this information and put it into a spreadsheet. The row has columns based on number of sizes and then price (item,sm,med,lg,9.99,10.99,12.99). After that return to the browser, i hit the back button and load the next item number into the field and so on and so forth. I am about to send a bunch of information your way, so sorry about that.

Upon doing some research I found a library for Python called mechanize which seemed to make it easy to submit web forms and then collect the data.

'''
Created on Sep 29, 2012

@author: Teddy
'''

from tkinter import *
import mechanize
import urllib
import logging
import sys
import http.cookiejar

def main():


br = mechanize.Browser()
cj = http.cookiejar.LWPCookieJar()
br.set_cookiejar(cj)
br.set_handle_equiv(True)
br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)

br.open('https://*******/cgi-bin/wfos/order.exe')

# Select the login form named "login"
br.select_form(name="login")

# User credentials, this is usrname and passwords to submit to form
br.form['custno'] = '*******'
br.form['Password1'] = '*******'
br.form['Password2'] = '**********'

# Login, submits to the form
br.submit()

main()

Currently when I compile this I get an error:

Traceback (most recent call last):
File "C:\EclipseWorkspaces\csse120\FOLDERNAME\src\main.py", line 9, in <module>
import mechanize
File "C:\Python32\lib\site-packages\mechanize\__init__.py", line 119, in <module>
from _version import __version__
ImportError: No module named _version

I looked in the \site-packages\mechanize folder and I saw a module name version.py. So I am not sure why I am getting this error.

The site I use reloads the page with new content with in it. There are buttons to choose the order you wish to load.

 <FORM NAME="orders" METHOD="POST" ACTION="https://******/cgi-bin/wfos/order.exe">
 <input type="hidden" name="form" value="continue">
 <input type="hidden" name="cs_id" value="">
 <input type="hidden" name="customer_type" value="1">
 <input type="hidden" name="customer" value="******">
 <input type="hidden" name="custno" value="******">
 <input type="hidden" name="password1" value="******">
 <input type="hidden" name="password2" value="******">

The stuff above is the post from the login page. The stuff below comes

<tr bgcolor=D3D3D3><td align=center><input name=del23558 type=checkbox></td>
<td align=center><input name=continue value=E23558 type=submit></td>
<td align=center><font size=-1>Sep 29 2012  1:19PM</font></td>
<td align=right><font size=-1>$0.00</font></td>
<td align=right><font size=-1>0</font></td></tr>
</table><P>
<input name="action" type="submit" value="Cancel Checked Orders" 
onClick="return confirm('Are you sure you want to cancel the checked orders?')"><P>
<input name="action" type="submit" value="Start a New Order"><P>
</FORM>

To submit the order would this still just be?:

 br.select_form(name="orders")
 br.form['continue'] = 'E23558'

Thank you very much for anyhelp you could provide.

  • 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-12T03:17:14+00:00Added an answer on June 12, 2026 at 3:17 am

    From your error message you are trying install and run the mechanize package with Python 3.2.

    mechanize however doesn’t support Python 3 so you should install a Python 2.x release (the latest available is 2.7.5), install the mechanize package there and then retry running your script.

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

Sidebar

Related Questions

I have done some work in Python, but I'm new to scipy . I'm
I am new to python programming..can someone suggest some way to do the following:
I am relatively new to C++ (previous experience in Python and dabbled in Java)
I have used Java, C++, .Net. (in that order). When asked about by-value vs.
I am primarily a web developer (ruby, python) that is new to iPhone development.
I am new to python.. In my test function I am passing some text
I'm new to the whole concept of screen scraping in Python, although I've done
I am new to python and struggling to get cython to speed up some
I'm really new to python and after several hours of looking I haven't been
I'm somewhat new to Python, Django, and I'd like some advice on how to

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.