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
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
akhil1988 wrote:
>
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 are byte strings. So you are mixing
> akhil1988 (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
>a> main()
>a> File "./temp.py", line 475, in main
>a> for line in sys.stdin:
>a> File "/u
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
> main()
> File "./temp.py", line 475, in main
> for line in sys.stdin:
>
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
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
(re
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 stri
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 == '':
> akhil1988 (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
>a> main()
>a> File "./temp.py", line 476, in main
>a> line.decode('utf-8').strip()
>a> AttributeError: 'str'
ok!
I got the indentation errors fixed. Bu I get another error:
Traceback (most recent call last):
File "./temp.py", line 484, in
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
Than
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 co
On Jul 16, 9:04 pm, akhil1988 wrote:
> 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.
What editor? I guess
akhil1988 wrote:
>
> akhil1988 wrote:
>>
>> 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 = {' ' :u'\u00A0', '¡'
>> :u'\u00A1',
>> '¢':u'\u00A2',
>>
On Jul 16, 9:00 pm, akhil1988 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 backwards compatible wi
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 ,
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 = {' ' :u'\u00A0', '¡' :u'\u00A1',
'¢':u'\u00A2',
^
SyntaxError: invalid syntax
line 81 is:
__char_
> akhil1988 (a) wrote:
>a> Chris,
>a> Using
>a> print (u'line: %s' % line).encode('utf-8')
>a> the 'line' gets printed, but actually this print statement I was using just
>a> for testing, actually my code operates on 'line', on which I use line =
>a> line.decode('utf-8') as 'line' is read
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 w
eplace('>>', u'»')
--Akhil
Chris Rebert-6 wrote:
>
>> Chris Rebert-6 wrote:
>>>
>>> On Wed, Jul 15, 2009 at 9:34 PM, akhil1988 wrote:
>>>>
>>>> Hi!
>>>>
>>>> Can anyone please help me getting
> Chris Rebert-6 wrote:
>>
>> On Wed, Jul 15, 2009 at 9:34 PM, akhil1988 wrote:
>>>
>>> Hi!
>>>
>>> Can anyone please help me getting rid of this error:
>>> UnicodeEncodeError: 'ascii' codec can't encode character u'\
; 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 giving a string to the python code as input, and python processes it
> like this:
>
> li
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 charact
On Wed, Jul 15, 2009 at 9:34 PM, akhil1988 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
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 usin
24 matches
Mail list logo