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

2015-01-14 Thread Dave Angel
$ ./main.py ꀀabcd޴ ~$ cat main.sh #!/usr/bin/env bash set -v ./main.py | xxd ./main_encode.py | xxd ~$ ./main.sh ./main.py | xxd Traceback (most recent call last): File "./main.py", line 4, in print u UnicodeEncodeError: 'ascii' codec can't encode character u&

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

2015-01-13 Thread Peng Yu
y | xxd Traceback (most recent call last): File "./main.py", line 4, in print u UnicodeEncodeError: 'ascii' codec can't encode character u'\ua000' in position 0: ordinal not in range(128) ./main_encode.py | xxd 000: ea80 8061 6263 64de b40a

Re: 'ascii' codec can't encode character u'\xe4' in position 4: ordinal not in range(128)

2009-11-08 Thread Ben Finney
balavignesh writes: > Whats the wrong in my code? Without seeing your code, all we could do is guess, poorly. Far better would be if you can construct a very small example, one that you post here so any reader here could run it, that demonstrates the behaviour you want explained. Don't forget t

'ascii' codec can't encode character u'\xe4' in position 4: ordinal not in range(128)

2009-11-08 Thread balavignesh
Hello friends, I am using pyWPS + GRASS to generate the maps for the given request XML. As my requestxml contains scandinavian letters , i got the following error, " 'ascii' codec can't encode character u'\xe4' in position 4: ordinal not in ra

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-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

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: > 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

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 (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

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 > main() > File "./temp.py", line 475, in main > for line in sys.stdin: >

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 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

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 stri

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 Piet van Oostrum
> 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'

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 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

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 co

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

2009-07-16 Thread John Machin
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

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

2009-07-16 Thread Max Erickson
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', >>

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 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

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 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 = {' ' :u'\u00A0', '¡' :u'\u00A1', '¢':u'\u00A2', ^ SyntaxError: invalid syntax line 81 is: __char_

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 (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

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 w

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

2009-07-15 Thread akhil1988
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

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, akhil1988 wrote: >>> >>> Hi! >>> >>> Can anyone please help me getting rid of this error: >>> UnicodeEncodeError: 'ascii' codec can't encode character u'\

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

2009-07-15 Thread akhil1988
; 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

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 charact

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, 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

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 usin

Re: Ascii codec can't encode

2008-10-30 Thread Ulrich Eckhardt
luca72 wrote: > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in > position 8: ordinal not in range(128) > > I have solve in this way: > > file_ricerca = codecs.open('ri', 'wb', 'ISO-8859-15', &#x

Re: Ascii codec can't encode

2008-10-30 Thread luca72
ython2.5/site-packages/eric4/DebugClients/Python/ AsyncIO.py", line 67, in readReady self.handleLine(s) File "/usr/lib/python2.5/site-packages/eric4/DebugClients/Python/ DebugClientBase.py", line 445, in handleLine execfile(sys.argv[0], self.debugMod.__dict__) File "/h

Re: Ascii codec can't encode

2008-10-30 Thread Marc 'BlackJack' Rintsch
On Thu, 30 Oct 2008 03:01:07 -0700, luca72 wrote: > the code is this > # -*- coding: ISO-8859-1 -*- > from BeautifulSoup import BeautifulSoup import urllib > sito = urllib.urlopen('http://text.net/') esamino = BeautifulSoup(sito) > luca = esamino.findAll('tr', align='center') lunghezza = len(luca)

Re: Ascii codec can't encode

2008-10-30 Thread luca72
Hello Again the code is this # -*- coding: ISO-8859-1 -*- from BeautifulSoup import BeautifulSoup import urllib sito = urllib.urlopen('http://text.net/') esamino = BeautifulSoup(sito) luca = esamino.findAll('tr', align='center') lunghezza = len(luca) messaggio_per_scar = open('me', 'wb') file_rice

Re: Ascii codec can't encode

2008-10-30 Thread Ulrich Eckhardt
luca72 wrote: > Hy the code is this: > > Pok\xe9mon That's not what I meant, I meant a piece of Python source code. This piece has to be large enough to demonstrate the problem but with everything else removed. The point is that guessing what is wrong in your program is just futile; In order to h

Re: Ascii codec can't encode

2008-10-30 Thread luca72
On 30 Ott, 10:27, luca72 <[EMAIL PROTECTED]> wrote: > Hy the code is this: > > Pok\xe9mon > > Luca Sorry is the é -- http://mail.python.org/mailman/listinfo/python-list

Re: Ascii codec can't encode

2008-10-30 Thread luca72
Hy the code is this: Pok\xe9mon Luca -- http://mail.python.org/mailman/listinfo/python-list

Re: Ascii codec can't encode

2008-10-30 Thread Ulrich Eckhardt
luca72 wrote: > hello i have this problem: > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in > position 8: ordinal not in range(128) This is the result of transcoding a Unicode string to ASCII, where the Unicode string contains a character

Ascii codec can't encode

2008-10-30 Thread luca72
hello i have this problem: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 8: ordinal not in range(128) Generally i solve the problem inserting : # -*- coding: ISO-8859-1 -*- at the top of the file but now he don't work can you

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

2005-11-06 Thread Diez B. Roggisch
> I would've thought that the 'b' option meant I can write any binary > code I like to the file, > but that's not so? You can. But if you write a unicode-object (wich is an abstract data type with no byte representation), it has to be converted to a string - which you have to do either explicit.

Re: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' inposition 99: ordinal not in range(128)

2005-11-06 Thread Fredrik Lundh
tNote > File "points.pyc", line 151, in setNote > File "point.pyc", line 100, in writeNote > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in > position 99: ordinal not in range(128) > > The piece of code in

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

2005-11-06 Thread Francach
e 151, in setNote File "point.pyc", line 100, in writeNote UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 99: ordinal not in range(128) The piece of code involved is: noteFileObj = open(noteFile, "wb") noteFil

Re: 'ascii' codec can't encode character u'\u2013'

2005-09-30 Thread John J. Lee
deelan <[EMAIL PROTECTED]> writes: [...] > query = "UPDATE blogs_news SET text = %s WHERE id=%s" > cursor.execute(query, (text_extrated, id)) > > so mysqldb will take care to quote text_extrated automatically. this > may not not your problem, but it's considered "good style" when dealing > with db

Re: 'ascii' codec can't encode character u'\u2013'

2005-09-30 Thread thomas Armstrong
Hi. Thank you both for your answers. Finally I changed my MySQL table to UTF-8 and changed the structure of the query (with '%s'). It works. Thank you very much. 2005/9/30, deelan <[EMAIL PROTECTED]>: > thomas Armstrong wrote: > (...) > > when trying to execute a MySQL query: > > > > query

Re: 'ascii' codec can't encode character u'\u2013'

2005-09-30 Thread deelan
thomas Armstrong wrote: (...) > when trying to execute a MySQL query: > > query = "UPDATE blogs_news SET text = '" + text_extrated + "'WHERE > id='" + id + "'" > cursor.execute (query) #<--- error line > well, to start it's not the best way to do an update, try this instead: query = "U

Re: 'ascii' codec can't encode character u'\u2013'

2005-09-30 Thread Fredrik Lundh
Thomas Armstrong wrote: > I'm trying to parse a UTF-8 document with special characters like > acute-accent vowels: > > > ... > --- > > But I get this error message: > --- > UnicodeEncodeError: 'ascii' codec can't encode character

'ascii' codec can't encode character u'\u2013'

2005-09-30 Thread thomas Armstrong
Hi Using Python 2.3.4 + Feedparser 3.3 (a library to parse XML documents) I'm trying to parse a UTF-8 document with special characters like acute-accent vowels: ... --- But I get this error message: --- UnicodeEncodeError: 'ascii' codec can't encode ch