The IOError and ValueError occurred because there was some sort of Unicode byte order mark (BOM). A non-break space was found in the second URL. Thanks for all your help and suggestion in solving the problem!!

2 Answers
2

Both of your examples work fine for me. The only explanation I can think of for your exact errors is that the second URL string contains some sort of non-printable character (a Unicode BOM, perhaps) that got filtered out when pasting the code here. Try copying the code back from this site into your file, or retyping the entire second string from scratch.

after removing the exception, i'm still getting the IOError as above.
–
alvasSep 30 '12 at 14:55

1

2er0, this is a question/answer site, not a crowdsourced interactive debugger. ask a question, get an answer, move to the next question. don't keep editing your code and question and re-asking different things.
–
Corey GoldbergSep 30 '12 at 15:04

it's the same problem and question. I've just made it more readable. =)
–
alvasSep 30 '12 at 15:08

oh i've found the problem!!! somehow Jasonharper was right. the second URL contained some sort of unicode BOM.
–
alvasSep 30 '12 at 15:13