bad data from urllib when run from MS .bat file

Stuart McGraw smcg4191 at frii.RimoovThisToReply.com
Sun Sep 19 22:29:51 EDT 2004


"John J. Lee" <jjl at pobox.com> wrote in message news:87acvmxayq.fsf at pobox.com...
> "Stuart McGraw" <smcg4191 at frii.RimoovThisToReply.com> writes:
> [...] 
> > So it looks like some bad mojo between urllib and the Windows
> > batch environment.
> 
> Just a guess, without actually bothering to think about the numerology
> in detail:
> 
> test.bat:
> ----------------
> python -u test.py http://etext.lib.virginia.edu/cgi-local/breen/wwwjdic?1W%BF%A9%A4%D9%A4%EB_v1
> ----------------
> 
> Note the -u switch (for 'unbuffered', but also 'um, binary mode'
> <wink>).

Did you try doing that?  Did it work for you?  I just tried here, and 
still have the same problem.

Even worse, in the original script that the test script is derived from
I encountered a new problem.  Intermixed with the web page data 
returned by urllib, is bits and pieces (10-20 characters long) of local 
file and directory names.  Only happens reading some web pages 
(EUC-JP encoded as with the original problem) but I'm wondering 
if there are some single-byte/double-byte character issues with urllib. 
That would be surprising to me given that urllib is shipped with the
Python distribution, I would think that any core libs would be pretty
bombproof.  (Am I being naive? :-) Of course, still possible I hosed 
something in my script, so I will double check... 
 





More information about the Python-list mailing list