On Sun, Apr 17, 2011 at 8:43 PM, Nikunj Badjatya <nikunjbadja...@gmail.com>wrote:
> Thanks for the quick reply.. > I hve never touched Django before. > > I tried as: > > {{{ > > #!/bin/python > > import os > import urllib > + from django.utils.encoding import smart_str > > fetch = urllib.urlopen("some-web-link.htm") > > mainfile = open ('main.html', 'w' ) > > + myunistr = smart_str(fetch) > > print myunistr > > mainfile.write(myunistr) > > > os.system('python2.6 html2text.py main.html > main.txt') > > }}} > > The execution went fine without any issues. But when I open the > "main.html". I was expecting it to havee full contents of the page . But it > has only , > {{{ > <addinfourl at 148983116 whose fp = <socket._fileobject object at > 0x8deabac>> > }}} > > Please let me know if I am missing something. > > Change myunistr = smart_str(fetch) to myunistr = smart_str(fetch.read()) -- ********************************** JAGANADH G http://jaganadhg.freeflux.net/blog *ILUGCBE* http://ilugcbe.techstud.org _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers