I've been working at this for nearly a week and just don't understand why it isn't working. The code works great in Windows, but once I move it to Linux, it doesn't work.

I'm basically using mechanize to login automatically to a website. The website requires cookies, however, and I can't get Linux to accept cookies using the mechanize classes. Windows works great!

Here's my code...pretty basic. Of course there is more, but this is the login part.

self.b = Browser()
self.b.open(URL_LOGIN)
self.b.select_form('Form1')
self.b["USER"] = USER
self.b["PASS"] = PASSWORD
login_response = self.b.submit()
print login_response.read()

Here is what I've tried so far.

Different versions of Ubuntu (8.04 and 9.04) with different versions of Python (2.5.2 and 2.6.2)

Install mechanize from apt sources and install mechanize from website using python setup.py install

Expliciting requiring cookies with:

self.cj = CookieJar()
self.b.set_cookiejar(cj)

NOTHING WORKS! Are there any ideas why? Please?!

bump...any ideas? This is driving me nuts. I've now tried different distributions of Linux as well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.