Re: [Tutor] Unicode Encode Error

2014-06-17 Thread Peter Otten
Aaron Misquith wrote: > I'm trying to obtain the questions present in StackOverflow for a > particular tag. > > Whenever I try to run the program i get this *error:* > > Message File Name Line Position > Traceback > C:\Users\Aaron\Desktop\question.py 20 > UnicodeEncodeError: 'ascii' codec c

[Tutor] Unicode Encode Error

2014-06-17 Thread Aaron Misquith
I'm trying to obtain the questions present in StackOverflow for a particular tag. Whenever I try to run the program i get this *error:* Message File Name Line Position Traceback C:\Users\Aaron\Desktop\question.py 20 UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in positi

Re: [Tutor] Unicode Encode Error

2006-04-27 Thread Danny Yoo
>>> You're right, I realised after playing with Tim's example that the >>> problem was that I wasn't calling close() on the codecs file. Adding >>> this after the f.write(html_text) seems to flush the buffer which >>> means that the content now gets written to the file. >> >> Quick note: it may

Re: [Tutor] Unicode Encode Error

2006-04-27 Thread Kent Johnson
Danny Yoo wrote: >> You're right, I realised after playing with Tim's example that the >> problem was that I wasn't calling close() on the codecs file. Adding >> this after the f.write(html_text) seems to flush the buffer which means >> that the content now gets written to the file. > > Hi Fran

Re: [Tutor] Unicode Encode Error

2006-04-27 Thread Danny Yoo
> You're right, I realised after playing with Tim's example that the > problem was that I wasn't calling close() on the codecs file. Adding > this after the f.write(html_text) seems to flush the buffer which means > that the content now gets written to the file. Hi Frank, Quick note: it may be

Re: [Tutor] Unicode Encode Error

2006-04-27 Thread Frank Moore
Kent Johnson wrote: >Do you explicitly close the output file? If not, the data may not be >actually written. > > Kent, You're right, I realised after playing with Tim's example that the problem was that I wasn't calling close() on the codecs file. Adding this after the f.write(html_text) seem

Re: [Tutor] Unicode Encode Error

2006-04-27 Thread Kent Johnson
Frank Moore wrote: > The later code (where I use codecs) is not giving me an error (I must > have got that error during an intermediate step I performed). > However, it's also not writing anything away. It seems to be silently > failing as html_text definitely has content. Do you explicitly clos

Re: [Tutor] Unicode Encode Error

2006-04-27 Thread Tim Golden
[Frank Moore] | I'm getting the following error when I try and write some HTML with | German text in it. | | UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in | position 1367: ordinal not in range(128) | | I've now read the 'Unicode - How To' by AMKuchling and | changed the

Re: [Tutor] Unicode Encode Error

2006-04-27 Thread Kent Johnson
Frank Moore wrote: > Hi, > > I'm getting the following error when I try and write some HTML with > German text in it. > > UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in > position 1367: ordinal not in range(128) > > This was my code: > > html_text = open(inFile, 'r'

[Tutor] Unicode Encode Error

2006-04-27 Thread Frank Moore
Hi, I'm getting the following error when I try and write some HTML with German text in it. UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 1367: ordinal not in range(128) This was my code: html_text = open(inFile, 'r').read() # ... do some processing on