views:

15

answers:

1

I'm not sure what's going on, as the script used to work (before I messed around with my python on my system...)

But when I try something along the lines of

import mechanize
browser = mechanize.Browser()
browser.open("http://google.com")

I get something like

<response_seek_wrapper at 0x10123fd88 whose wrapped object = <closeable_response at 0x101232170 whose fp = <socket._fileobject object at 0x1010bf5f0>>>

Does anyone know why this is and what the fix is?

thanks!

+1  A: 

it's not an exception, is it?
nothing wrong is happening, you just got a return value, which is esentially a response object, equivalent to br.response().

see

>>> r = browser.open("http://google.com")
>>> r
<response_seek_wrapper at 0x9bb116c whose wrapped object = <closeable_response at 0x9bb426c whose fp = <socket._fileobject object at 0x9ba306c>>>
>>> r.info().headers
# see the response headers

vs

>>> browser.open("http://google.com")
>>> browser.response()
<response_seek_wrapper at 0x9c229cc whose wrapped object = <closeable_response at 0x9bb426c whose fp = <socket._fileobject object at 0x9ba306c>>>
>>> browser.response().info().headers
# see the response headers
mykhal
Ah, I guess I just alwats used r = browser.open, which never gave that response. thanks!
Parker
@Parker no problem, i was also little bit scared, when i saw this object first time :)
mykhal