Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-18 Thread akhil1988
Thanks Nobody-38, it solved my problem immediately. --Thanks Again, Akhil Nobody-38 wrote: On Thu, 16 Jul 2009 20:26:39 -0700, akhil1988 wrote: Well, you were write: unintentionally I removed strip(). But the problem does not ends here: I get this error now: File ./temp.py, line

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-18 Thread akhil1988
Thanks David, it solved my problem immediately. I will follow your advise from next time but honestly I am new to python with not much knowledge about text formats. And the main portion of my project was not to deal with these, so I just wanted to get this solved as I was already struck at this

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-17 Thread Nobody
On Thu, 16 Jul 2009 20:26:39 -0700, akhil1988 wrote: Well, you were write: unintentionally I removed strip(). But the problem does not ends here: I get this error now: File ./temp.py, line 488, in module main() File ./temp.py, line 475, in main for line in sys.stdin: File

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-17 Thread Piet van Oostrum
akhil1988 akhilan...@gmail.com (a) wrote: a Well, you were write: unintentionally I removed strip(). But the problem does a not ends here: a I get this error now: a File ./temp.py, line 488, in module a main() a File ./temp.py, line 475, in main a for line in sys.stdin: a File

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-17 Thread Scott David Daniels
akhil1988 wrote: mis-ordered reply, bits shown below Nobody-38 wrote: On Thu, 16 Jul 2009 15:43:37 -0700, akhil1988 wrote: ... In Python 3 you can't decode strings because they are Unicode strings and it doesn't make sense to decode a Unicode string. You can only decode encoded things which

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread John Nagle
akhil1988 wrote: Sorry, it is sgmllib.py and not sgmmlib.py Oh, that bug again. See http://bugs.python.org/issue1651995 It's a bug in SGMLParser. When Python 2.5 restricted ASCII to 0..127, SGMLParser needed to be modified, but wasn't. I reported that bug in February 2007. It

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread akhil1988
I have switched to python 3.1 , but now I am getting some syntax errors in the code: File ./customWikiExtractor.py, line 81 __char_entities = {'nbsp;' :u'\u00A0', 'iexcl;' :u'\u00A1', 'cent;':u'\u00A2', ^ SyntaxError: invalid syntax line 81

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread akhil1988
Please click reply on the post and then read this reply in the editor. Actually, some sequences have been replaced to their graphical form when this post is published. So the python code is being displayed, what actually it is not. --Akhil akhil1988 wrote: I have switched to python 3.1 ,

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread alex23
On Jul 16, 9:00 pm, akhil1988 akhilan...@gmail.com wrote: I have switched to python 3.1 , but now I am getting some syntax errors in the code: Python 3.x was a major release that endeavoured to clean up a number of lingering issues with the language, the upshot being that it isn't entirely

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread akhil1988
Hi, Thanks all for the replies. I am working on a cluster of 15 nodes and I have now installed python 3.1 on all of them. I tried installing python2.6 but there was some make error. So, I do not want to give more time in installing 2.4 and rather use 3.1 but for that I need to convert my 2.4

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread akhil1988
ok! I got the indentation errors fixed. Bu I get another error: Traceback (most recent call last): File ./temp.py, line 484, in module main() File ./temp.py, line 476, in main line.decode('utf-8').strip() AttributeError: 'str' object has no attribute 'decode' I am using Python3.1

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread Piet van Oostrum
akhil1988 akhilan...@gmail.com (a) wrote: a ok! a I got the indentation errors fixed. Bu I get another error: a Traceback (most recent call last): a File ./temp.py, line 484, in module a main() a File ./temp.py, line 476, in main a line.decode('utf-8').strip() a AttributeError:

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread akhil1988
Then, how should I do it? I read a byte string from sys.stdin which needs to converted to unicode string for further processing. I cannot just remove the decode statement and proceed? This is it what it looks like: for line in sys.stdin: line = line.decode('utf-8').strip() if line ==

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread Nobody
On Thu, 16 Jul 2009 15:43:37 -0700, akhil1988 wrote: In Python 3 you can't decode strings because they are Unicode strings and it doesn't make sense to decode a Unicode string. You can only decode encoded things which are byte strings. So you are mixing up byte strings and Unicode strings.

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-16 Thread akhil1988
Well, you were write: unintentionally I removed strip(). But the problem does not ends here: I get this error now: File ./temp.py, line 488, in module main() File ./temp.py, line 475, in main for line in sys.stdin: File /usr/local/lib/python3.1/codecs.py, line 300, in decode

UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-15 Thread akhil1988
Hi! Can anyone please help me getting rid of this error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128) I am not a python programmer (though intend to start learning this wonderful language), I am just using a python script. After

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-15 Thread Chris Rebert
On Wed, Jul 15, 2009 at 9:34 PM, akhil1988akhilan...@gmail.com wrote: Hi! Can anyone please help me getting rid of this error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128) I am not a python programmer (though intend to start

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-15 Thread akhil1988
Well, All I get is this traceback: File ./customWikiExtractor.py, line 492, in ? main() File ./customWikiExtractor.py, line 480, in main print sys.stdout, 'line: %s' % line UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128) I am

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-15 Thread akhil1988
, 2009 at 9:34 PM, akhil1988akhilan...@gmail.com wrote: Hi! Can anyone please help me getting rid of this error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128) I am not a python programmer (though intend to start learning

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-15 Thread Chris Rebert
Chris Rebert-6 wrote: On Wed, Jul 15, 2009 at 9:34 PM, akhil1988akhilan...@gmail.com wrote: Hi! Can anyone please help me getting rid of this error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128) I am not a python programmer

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

2009-07-15 Thread akhil1988
, akhil1988akhilan...@gmail.com wrote: Hi! Can anyone please help me getting rid of this error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128) I am not a python programmer (though intend to start learning this wonderful language), I