I would say so as well.
Thanks to everyone who helped.
Regards and best wishes.
--
https://mail.python.org/mailman/listinfo/python-list
On 05/10/2015 05:10 PM, zljubisic...@gmail.com wrote:
No, we can't see what ROOTDIR is, since you read it from the config
file. And you don't show us the results of those prints. You don't
even show us the full exception, or even the line it fails on.
Sorry I forgot. This is the output of the
> No, we can't see what ROOTDIR is, since you read it from the config
> file. And you don't show us the results of those prints. You don't
> even show us the full exception, or even the line it fails on.
Sorry I forgot. This is the output of the script:
C:\Python34\python.exe C:/Users/zoran/P
> > It works, but if you change title = title[:232] to title = title[:233],
> > you will get "FileNotFoundError: [Errno 2] No such file or directory".
>
>
> Which is a *completely different* error from
>
> SyntaxError: 'unicodeescape' codec can't decode bytes in position 2-3:
> truncated \U
On Sun, May 10, 2015 at 1:13 AM, Steven D'Aprano
wrote:
> FileNotFoundError means that the program did run, it tried to open a file,
> but the file doesn't exist.
Normally it does, at least. Sometimes it means that a *directory*
doesn't exist (for instance, you can get this when you try to create
On Sat, 9 May 2015 08:31 pm, zljubisic...@gmail.com wrote:
> It works, but if you change title = title[:232] to title = title[:233],
> you will get "FileNotFoundError: [Errno 2] No such file or directory".
Which is a *completely different* error from
SyntaxError: 'unicodeescape' codec can't de
On 05/09/2015 06:31 AM, zljubisic...@gmail.com wrote:
title = title[:232]
title = title.replace(" ", "_").replace("/", "_").replace("!", "_").replace("?",
"_")\
.replace('"', "_").replace(':', "_").replace(',',
"_").replace('"', '')\
.replace('\n', '_'
Steven,
please do look at the code bellow:
# C:\Users\zoran\PycharmProjects\mm_align\hrt3.cfg contents
# [Dir]
# ROOTDIR = C:\Users\zoran\hrt
import os
import shutil
import configparser
import requests
import re
Config = configparser.ConfigParser()
Config.optionxform = str # preserve case in i
string-literal containing \U is an escape sequence which
expects exactly 8 hexadecimal digits to follow:
py> path = '\U00a7'
py> print(path)
§
If you don't follow the \U with eight hex digits, you get an error:
py> path = '\Users~~~~'
Fil
On Sat, May 9, 2015 at 5:00 AM, wrote:
> But it returns the following error:
>
>
> C:\Python34\python.exe C:/Users/bckslash_test.py
> File "C:/Users/bckslash_test.py", line 4
> ROOTDIR = 'C:\Users'
> ^
> SyntaxError: (unicode error)
Thanks for clarifying.
Looks like the error message was wrong.
On windows ntfs I had a file name more than 259 characters which is widows
limit.
After cutting file name to 259 characters everything works as it should.
If I cut file name to 260 characters I get the error from subject which is
wron
file1, file2)
But it returns the following error:
C:\Python34\python.exe C:/Users/bckslash_test.py
File "C:/Users/bckslash_test.py", line 4
ROOTDIR = 'C:\Users'
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in
On Fri, May 8, 2015, at 15:00, zljubisic...@gmail.com wrote:
> As I saw, I could solve the problem by changing line 4 to (small letter
> "r" before string:
> ROOTDIR = r'C:\Users\zoran'
>
> but that is not an option for me because I am using configparser in order
> to read the ROOTDIR from underly
or:
C:\Python34\python.exe C:/Users/bckslash_test.py
File "C:/Users/bckslash_test.py", line 4
ROOTDIR = 'C:\Users'
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in
position 2-3: truncated \U escape
Process
On 10/4/2013 3:35 PM, Serhiy Storchaka wrote:
04.10.13 16:56, Steven D'Aprano написав(ла):
I have some custom Unicode error handlers, and I'm looking for advice on
the right API for dealing with them.
I'm planning to built this error handler in 3.4 (see
http://com
04.10.13 16:56, Steven D'Aprano написав(ла):
I have some custom Unicode error handlers, and I'm looking for advice on
the right API for dealing with them.
I have a module containing custom Unicode error handlers. For example:
# Python 3
import unicodedata
def namereplace_errors(ex
04.10.13 20:22, Chris Angelico написав(ла):
I'd be quite happy with importing having a side-effect here. If you
import a module that implements a numeric type, it should immediately
register itself with the Numeric ABC, right? This is IMO equivalent to
that.
There is a difference. You can't use
On 10/04/2013 06:56 AM, Steven D'Aprano wrote:
Should the module holding the error handlers automatically register them?
I think it should.
Registration only needs to happen once, the module is useless without being registered, no threads nor processes are
being started, and the only reason
On Fri, Oct 4, 2013 at 11:56 PM, Steven D'Aprano
wrote:
> Should the module holding the error handlers automatically register them?
> In other words, if I do:
>
> import error_handlers
>
> just importing it will have the side-effect of registering the error
> handlers. Normally, I dislike imports
I have some custom Unicode error handlers, and I'm looking for advice on
the right API for dealing with them.
I have a module containing custom Unicode error handlers. For example:
# Python 3
import unicodedata
def namereplace_errors(exc):
c = exc.object[exc.start]
try:
Le jeudi 8 novembre 2012 21:42:58 UTC+1, Ian a écrit :
> On Thu, Nov 8, 2012 at 12:54 PM, wrote:
>
> > Font has nothing to do here.
>
> > You are "simply" wrongly encoding your "unicode".
>
> >
>
> '\u2013'
>
> > '–'
>
> '\u2013'.encode('utf-8')
>
> > b'\xe2\x80\x93'
>
> '\
On 2012.11.08 08:06, Oscar Benjamin wrote:
> It would be a lot better though if it just worked straight away
> without me needing to set the code page (like the terminal in every
> other OS I use).
The crude equivalent of .bashrc/.zshrc/whatever shell startup script for
cmd is setting a string valu
On 8 November 2012 19:54, wrote:
> Le jeudi 8 novembre 2012 19:49:24 UTC+1, Ian a écrit :
>> On Thu, Nov 8, 2012 at 11:32 AM, Oscar Benjamin
>>
>> wrote:
>>
>> > If I want the other characters to work I need to change the code page:
>>
>> >
>>
>> > O:\>chcp 65001
>>
>> > Active code page: 65001
On Thu, Nov 8, 2012 at 1:54 PM, Prasad, Ramit wrote:
> Why would font not matter? Unicode is the abstract definition
> of all characters right? From that we map the abstract
> character to a code page/set, which gives real values for an
> abstract character. From that code page we then visually di
wxjmfa...@gmail.com wrote:
>
> Le jeudi 8 novembre 2012 19:49:24 UTC+1, Ian a écrit :
> > On Thu, Nov 8, 2012 at 11:32 AM, Oscar Benjamin
> >
> > wrote:
> >
> > > If I want the other characters to work I need to change the code page:
> > >
> > > O:\>chcp 65001
> > > Active code page: 65001
> > >
On Thu, Nov 8, 2012 at 12:54 PM, wrote:
> Font has nothing to do here.
> You are "simply" wrongly encoding your "unicode".
>
'\u2013'
> '–'
'\u2013'.encode('utf-8')
> b'\xe2\x80\x93'
'\u2013'.encode('utf-8').decode('cp1252')
> '–'
No, it seriously is the font. This is what I ge
Le jeudi 8 novembre 2012 19:49:24 UTC+1, Ian a écrit :
> On Thu, Nov 8, 2012 at 11:32 AM, Oscar Benjamin
>
> wrote:
>
> > If I want the other characters to work I need to change the code page:
>
> >
>
> > O:\>chcp 65001
>
> > Active code page: 65001
>
> >
>
> > O:\>Q:\tools\Python33\python
Le jeudi 8 novembre 2012 19:32:14 UTC+1, Oscar Benjamin a écrit :
> On 8 November 2012 15:05, wrote:
>
> > Le jeudi 8 novembre 2012 15:07:23 UTC+1, Oscar Benjamin a écrit :
>
> >> On 8 November 2012 00:44, Oscar Benjamin
> >> wrote:
>
> >> > On 7 November 2012 23:51, Andrew Berg wrote:
>
>
On Thu, Nov 8, 2012 at 11:32 AM, Oscar Benjamin
wrote:
> If I want the other characters to work I need to change the code page:
>
> O:\>chcp 65001
> Active code page: 65001
>
> O:\>Q:\tools\Python33\python -c "import sys;
> sys.stdout.buffer.write('\u03b1\n'.encode('utf-8'))"
> α
>
> O:\>Q:\tools\
On 8 November 2012 15:05, wrote:
> Le jeudi 8 novembre 2012 15:07:23 UTC+1, Oscar Benjamin a écrit :
>> On 8 November 2012 00:44, Oscar Benjamin wrote:
>> > On 7 November 2012 23:51, Andrew Berg wrote:
>> >> On 2012.11.07 17:27, Oscar Benjamin wrote:
>>
>> >>> Are you using cmd.exe (standard Wi
Le jeudi 8 novembre 2012 15:07:23 UTC+1, Oscar Benjamin a écrit :
> On 8 November 2012 00:44, Oscar Benjamin wrote:
>
> > On 7 November 2012 23:51, Andrew Berg wrote:
>
> >> On 2012.11.07 17:27, Oscar Benjamin wrote:
>
> >>> Are you using cmd.exe (standard Windows terminal)? If so, it does not
On 8 November 2012 00:44, Oscar Benjamin wrote:
> On 7 November 2012 23:51, Andrew Berg wrote:
>> On 2012.11.07 17:27, Oscar Benjamin wrote:
>>> Are you using cmd.exe (standard Windows terminal)? If so, it does not
>>> support unicode
>> Actually, it does. Code page 65001 is UTF-8. I know that do
Right solution to unicode error?
>
> On 7 November 2012 22:17, Anders wrote:
> >
> > Traceback (most recent call last):
> > File "outlook_tasks.py", line 66, in
> > my_tasks.dump_today_tasks()
> > File "C:\Users\Anders\code\Task List\t
On 8/11/12 00:53:49, Steven D'Aprano wrote:
> This error confuses me. Is that an exact copy and paste of the error, or
> have you edited it or reconstructed it? Because it seems to me that if
> task.subject is a unicode string, as it appears to be, calling print on
> it should succeed:
>
> py>
Le mercredi 7 novembre 2012 23:17:42 UTC+1, Anders a écrit :
> I've run into a Unicode error, and despite doing some googling, I
>
> can't figure out the right way to fix it. I have a Python 2.6 script
>
> that reads my Outlook 2010 task list. I'm able to read t
On 7 November 2012 23:51, Andrew Berg wrote:
> On 2012.11.07 17:27, Oscar Benjamin wrote:
>> Are you using cmd.exe (standard Windows terminal)? If so, it does not
>> support unicode
> Actually, it does. Code page 65001 is UTF-8. I know that doesn't help
> the OP since Python versions below 3.3 don
On Wed, 07 Nov 2012 14:17:42 -0800, Anders wrote:
> I've run into a Unicode error, and despite doing some googling, I can't
> figure out the right way to fix it. I have a Python 2.6 script that
> reads my Outlook 2010 task list. I'm able to read the tasks from Outlook
&g
On 2012.11.07 17:27, Oscar Benjamin wrote:
> Are you using cmd.exe (standard Windows terminal)? If so, it does not
> support unicode
Actually, it does. Code page 65001 is UTF-8. I know that doesn't help
the OP since Python versions below 3.3 don't support cp65001, but I
think it's important to poin
On 7 November 2012 22:17, Anders wrote:
>
> Traceback (most recent call last):
> File "outlook_tasks.py", line 66, in
> my_tasks.dump_today_tasks()
> File "C:\Users\Anders\code\Task List\tasks.py", line 29, in
> dump_today_tasks
> print task.subject
> UnicodeEncodeError: 'ascii' codec
Anders wrote:
>
> I've run into a Unicode error, and despite doing some googling, I
> can't figure out the right way to fix it. I have a Python 2.6 script
> that reads my Outlook 2010 task list. I'm able to read the tasks from
> Outlook and store them as a list of
I've run into a Unicode error, and despite doing some googling, I
can't figure out the right way to fix it. I have a Python 2.6 script
that reads my Outlook 2010 task list. I'm able to read the tasks from
Outlook and store them as a list of objects without a hitch. But when
I t
On 3/11/2012 10:37 AM, Steven D'Aprano wrote:
At least two standard error handlers are documented as working for
encoding only:
xmlcharrefreplace
backslashreplace
See http://docs.python.org/library/codecs.html#codec-base-classes
and http://docs.python.org/py3k/library/codecs.html
Why is this?
On 11.03.12 15:37, Steven D'Aprano wrote:
At least two standard error handlers are documented as working for
encoding only:
xmlcharrefreplace
backslashreplace
See http://docs.python.org/library/codecs.html#codec-base-classes
and http://docs.python.org/py3k/library/codecs.html
Why is this? I
At least two standard error handlers are documented as working for
encoding only:
xmlcharrefreplace
backslashreplace
See http://docs.python.org/library/codecs.html#codec-base-classes
and http://docs.python.org/py3k/library/codecs.html
Why is this? I don't see why they shouldn't work for decodi
On Tue, Feb 8, 2011 at 5:41 PM, Chris Rebert wrote:
> On Tue, Feb 8, 2011 at 7:57 AM, Rickard Lindberg wrote:
>> Hi,
>>
>> Here is a bash script to reproduce my error:
>
> Including the error message and traceback is still helpful, for future
> reference.
>
>> #!/bin/sh
>>
>> cat > å.timeli
Rickard Lindberg, 09.02.2011 14:01:
Did you read my reply?
Sorry, it was me who failed to read your question properly.
Unicode file names aren't really working well, especially not in Py2.x.
Python 3.2 provides many improvements here.
I assume your file system encoding is UTF-8? What does
sys
>> Did you read my reply?
>
>Sorry, it was me who failed to read your question properly.
>
>Unicode file names aren't really working well, especially not in Py2.x.
>Python 3.2 provides many improvements here.
>
>I assume your file system encoding is UTF-8? What does
>sys.getfilesystemencoding() giv
Stefan Behnel, 09.02.2011 09:58:
Rickard Lindberg, 09.02.2011 09:32:
On Tue, Feb 8, 2011 at 5:41 PM, Chris Rebert wrote:
Here is a bash script to reproduce my error:
Including the error message and traceback is still helpful, for future
reference.
Thanks for pointing it out.
#!/bin/sh
ca
Rickard Lindberg, 09.02.2011 09:32:
On Tue, Feb 8, 2011 at 5:41 PM, Chris Rebert wrote:
Here is a bash script to reproduce my error:
Including the error message and traceback is still helpful, for future
reference.
Thanks for pointing it out.
#!/bin/sh
cat> å.timeline<
EOF
On Tue, Feb 8, 2011 at 5:41 PM, Chris Rebert wrote:
>> Here is a bash script to reproduce my error:
>
> Including the error message and traceback is still helpful, for future
> reference.
Thanks for pointing it out.
>> #!/bin/sh
>>
>> cat > å.timeline <
>> EOF
>>
>> python <> # e
Rickard Lindberg, 08.02.2011 16:57:
Hi,
Here is a bash script to reproduce my error:
#!/bin/sh
cat> å.timeline<
0.13.0devb38ace0a572b+
2011-02-01 00:00:00
2011-02-03 08:46:00
asdsd
On Tue, Feb 8, 2011 at 7:57 AM, Rickard Lindberg wrote:
> Hi,
>
> Here is a bash script to reproduce my error:
Including the error message and traceback is still helpful, for future
reference.
> #!/bin/sh
>
> cat > å.timeline <
> EOF
>
> python < # encoding: utf-8
> from xml.sa
Hi,
Here is a bash script to reproduce my error:
#!/bin/sh
cat > å.timeline <
0.13.0devb38ace0a572b+
2011-02-01 00:00:00
2011-02-03 08:46:00
asdsd
2011-01-24 16:38:11
In <4c5d4ad9$0$28666$c3e8...@news.astraweb.com> Steven D'Aprano
writes:
>On Sat, 07 Aug 2010 19:28:56 +1200, Gregory Ewing wrote:
>> Steven D'Aprano wrote:
>>> "No memory? No disk space? No problem! Just a flesh wound!" What's
>>> the point of that?
>>
>> +1 QOTW
>While I'm always happy to
Steven D'Aprano wrote:
"No memory? No disk space? No problem! Just a flesh
wound!" What's the point of that?
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 06 Aug 2010 11:23:50 +, kj wrote:
> I don't get your point. Even when I *know* that a certain exception may
> happen, I don't necessarily catch it. I catch only those exceptions for
> which I can think of a suitable response that is *different* from just
> letting the program fail.
In Nobody
writes:
>On Fri, 23 Jul 2010 10:42:26 +, Steven D'Aprano wrote:
>> Don't write bare excepts, always catch the error you want and nothing
>> else.
>That advice would make more sense if it was possible to know which
>exceptions could be raised. In practice, that isn't possible, a
In article ,
Nobody wrote:
>
>Java's checked exception mechanism was based on real-world experience of
>the pitfalls of abstract types. And that experience was gained in
>environments where interface specifications were far more detailed than is
>the norm in the Python world.
There are a number
On Sun, 25 Jul 2010 14:47:11 +, Steven D'Aprano wrote:
>>> But in the
>>> meanwhile, once you get an error, you know what it is. You can
>>> intentionally feed code bad data and see what you get. And then maybe
>>> add a test to make sure your code traps such errors.
>>
>> That doesn't really
On Sun, 25 Jul 2010 13:52:33 +0100, Nobody wrote:
> On Fri, 23 Jul 2010 18:27:50 -0400, Terry Reedy wrote:
>
>> But in the
>> meanwhile, once you get an error, you know what it is. You can
>> intentionally feed code bad data and see what you get. And then maybe
>> add a test to make sure your cod
On Fri, 23 Jul 2010 18:27:50 -0400, Terry Reedy wrote:
> But in the
> meanwhile, once you get an error, you know what it is. You can
> intentionally feed code bad data and see what you get. And then maybe
> add a test to make sure your code traps such errors.
That doesn't really help with exce
dirknbr gmail.com> writes:
> I have kind of developped this but obviously it's not nice, any better
> ideas?
>
> try:
> text=texts[i]
> text=text.encode('latin-1')
> text=text.encode('utf-8')
> except:
> text=' '
As Steven has poin
On Fri, 23 Jul 2010 22:46:46 +0100, Nobody wrote:
> On Fri, 23 Jul 2010 10:42:26 +, Steven D'Aprano wrote:
>
>> Don't write bare excepts, always catch the error you want and nothing
>> else.
>
> That advice would make more sense if it was possible to know which
> exceptions could be raised.
On 7/23/2010 5:46 PM, Nobody wrote:
On Fri, 23 Jul 2010 10:42:26 +, Steven D'Aprano wrote:
Don't write bare excepts, always catch the error you want and nothing
else.
That advice would make more sense if it was possible to know which
exceptions could be raised. In practice, that isn't pos
On 07/23/2010 11:46 PM, Nobody wrote:
> On Fri, 23 Jul 2010 10:42:26 +, Steven D'Aprano wrote:
>
>> Don't write bare excepts, always catch the error you want and nothing
>> else.
>
> That advice would make more sense if it was possible to know which
> exceptions could be raised. In practice,
On Fri, Jul 23, 2010 at 2:46 PM, Nobody wrote:
> On Fri, 23 Jul 2010 10:42:26 +, Steven D'Aprano wrote:
>
>> Don't write bare excepts, always catch the error you want and nothing
>> else.
>
> That advice would make more sense if it was possible to know which
> exceptions could be raised. In pr
On Fri, 23 Jul 2010 10:42:26 +, Steven D'Aprano wrote:
> Don't write bare excepts, always catch the error you want and nothing
> else.
That advice would make more sense if it was possible to know which
exceptions could be raised. In practice, that isn't possible, as the
documentation seldom
;results']:
> ids.append(u[u'id'])
> texts.append(u[u'text'])
>
> This is where texts comes from.
>
> When I then want to write texts to a file I get the unicode error.
So your data is unicode? Good.
Well, files are just streams of bytes
.append(u[u'text'])
This is where texts comes from.
When I then want to write texts to a file I get the unicode error.
Dirk
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Jul 23, 2010 at 3:14 AM, dirknbr wrote:
> I am having some problems with unicode from json.
>
> This is the error I get
>
> UnicodeEncodeError: 'ascii' codec can't encode character u'\x93' in
> position 61: ordinal not in range(128)
Please include the full Traceback and the actual code th
On Fri, 23 Jul 2010 03:14:11 -0700, dirknbr wrote:
> I am having some problems with unicode from json.
>
> This is the error I get
>
> UnicodeEncodeError: 'ascii' codec can't encode character u'\x93' in
> position 61: ordinal not in range(128)
>
> I have kind of developped this but obviously it
I am having some problems with unicode from json.
This is the error I get
UnicodeEncodeError: 'ascii' codec can't encode character u'\x93' in
position 61: ordinal not in range(128)
I have kind of developped this but obviously it's not nice, any better
ideas?
try:
text=texts[
On Jan 21, 7:08 pm, John Machin wrote:
>
> To replace non-ASCII characters in a UTF-8-encoded string by spaces:
> | >>> u8 = ' and 25\xc2\xb0F'
> | >>> u = u8.decode('utf8')
> | >>> ''.join([chr(ord(c)) if c <= u'\x7f' else ' ' for c in u])
> | ' and 25 F'
Thanks John for your reply. This is what
On Mittwoch, 21. Januar 2009, Gaurav Veda wrote:
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position
> 4357: ordinal not in range(128)
>
> Before sending the (insert) query to the mysql server, I do the
> following which I think should've taken care of this problem:
> sqlStr =
On Jan 22, 9:50 am, Gaurav Veda wrote:
> > The 0xc2 strongly suggests that you are feeding the beast data encoded
> > in UTF-8 while giving it no reason to believe that it is in fact not
> > encoded in ASCII. Curiously the first errant byte is a long way (4KB)
> > into your data. Consider doing
>
> The 0xc2 strongly suggests that you are feeding the beast data encoded
> in UTF-8 while giving it no reason to believe that it is in fact not
> encoded in ASCII. Curiously the first errant byte is a long way (4KB)
> into your data. Consider doing
> print repr(data)
> to see what you've actual
On Jan 22, 4:49 am, Gaurav Veda wrote:
> Hi,
>
> I am trying to put some webpages into a mysql database using python
> (after some processing on the text). If I use Python 2.4.2, it works
> without a fuss. However, on Python 2.5, I get the following error:
>
> UnicodeDecodeError: 'ascii' codec can
Hi,
I am trying to put some webpages into a mysql database using python
(after some processing on the text). If I use Python 2.4.2, it works
without a fuss. However, on Python 2.5, I get the following error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position
4357: ordinal not in
Martin v. Löwis wrote:
>> path += '/' + b
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 1:
>> ordinal not in range(128)
>>
>> Any ideas?
>
> path is a Unicode string, b is a byte string and contains the
> byte \xd0.
>
> The problem is that you have a directory with f
> path += '/' + b
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 1:
> ordinal not in range(128)
>
> Any ideas?
path is a Unicode string, b is a byte string and contains the
byte \xd0.
The problem is that you have a directory with file names in it that
cannot be conver
This:
for root, dirs, files in os.walk(search_path):
for f in files:
print f
###
Produces this:
Traceback (most recent call last):
File "/home/brad/Desktop/my_script.pyw", line 340, in -toplevel-
hunt(target_files(search_path, skip_file_extensions(),
skip_file
[EMAIL PROTECTED] wrote:
> On Jan 30, 11:28 pm, Walter Dörwald <[EMAIL PROTECTED]> wrote:
>
>> codecs.register_error("transliterate", transliterate)
>>
>>Walter
>
> Really, really slick solution.
> Though, why was it [:1], not [0]? ;-)
No particular reason, unicodedata.normalize("NFD", ...)
Martin v. Löwis wrote:
> Walter Dörwald schrieb:
>> You might try the following:
>>
>> # -*- coding: iso-8859-1 -*-
>>
>> import unicodedata, codecs
>>
>> def transliterate(exc):
>> if not isinstance(exc, UnicodeEncodeError):
>> raise TypeError("don'ty know how to handle %r" % r)
En Wed, 31 Jan 2007 01:21:49 -0300, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> escribió:
> I don't understand what %r and r are and where they are from. The man
> 3 printf page doesn't have %r formatting.
Perhaps you should look into the Python docs instead?
--
Gabriel Genellina
--
http://mail.p
Walter Dörwald schrieb:
> You might try the following:
>
> # -*- coding: iso-8859-1 -*-
>
> import unicodedata, codecs
>
> def transliterate(exc):
> if not isinstance(exc, UnicodeEncodeError):
> raise TypeError("don'ty know how to handle %r" % r)
> return (unicodedata.n
On Jan 30, 11:28 pm, Walter Dörwald <[EMAIL PROTECTED]> wrote:
>
> codecs.register_error("transliterate", transliterate)
>
>Walter
Really, really slick solution.
Though, why was it [:1], not [0]? ;-)
And one more thing:
> def transliterate(exc):
> if not isinstance(exc, UnicodeEncode
Rares Vernica wrote:
> Hi,
>
> Does anyone know of any Unicode encode/decode error handler that does a
> better replace job than the default replace error handler?
>
> For example I have an iso-8859-1 string that has an 'e' with an accent
> (you know, the French 'e's). When I use s.encode('asci
It does the job.
Thanks a lot,
Ray
Peter Otten wrote:
> Rares Vernica wrote:
>
>> Is there an encode/decode error handler that can replace all the
>> not-ascii letters from iso-8859-1 with their closest ascii letter?
>
> A mapping, not an error handler, but it might do the job:
>
> http://effb
Rares Vernica wrote:
> Is there an encode/decode error handler that can replace all the
> not-ascii letters from iso-8859-1 with their closest ascii letter?
No, but IBM's ICU library can transform one script to another in very flexible
and capable ways. One such configuration can do what you ask.
Rares Vernica wrote:
> Is there an encode/decode error handler that can replace all the
> not-ascii letters from iso-8859-1 with their closest ascii letter?
A mapping, not an error handler, but it might do the job:
http://effbot.org/zone/unicode-convert.htm
Peter
--
http://mail.python.org/mail
Hi,
Does anyone know of any Unicode encode/decode error handler that does a
better replace job than the default replace error handler?
For example I have an iso-8859-1 string that has an 'e' with an accent
(you know, the French 'e's). When I use s.encode('ascii', 'replace') the
'e' will be rep
[Gallagher, Tim (NE)]
| Hey all I am learning Python and having a fun time doing so.
| I have a question for y'all, it has to do with active directory.
| I want to get the last login for a computer from Active
| Directory. I am using the active_directory module and here
| is my code.
[START
Hey all I am learning Python
and having a fun time doing so. I have a question for y'all, it has to do with
active directory.
I want to get the last login
for a computer from Active Directory. I am using the active_directory module
and here is my code.
[START
[EMAIL PROTECTED] wrote:
> I have this python code:
> print >> htmlFile, " style=\"width: 200px; height:18px;\">";
>
>
> But that caues this error, and I can't figure it out why. Any help is
> appreicate
> File "./run.py", line 193, in ?
> print >> htmlFile, " style=\"width: 200px; height:18
[EMAIL PROTECTED] wrote:
> I have this python code:
> print >> htmlFile, " style=\"width: 200px; height:18px;\">";
>
>
> But that caues this error, and I can't figure it out why. Any help is
> appreicate
> File "./run.py", line 193, in ?
> print >> htmlFile, " style=\"width: 200px; height:18
I have this python code:
print >> htmlFile, "";
But that caues this error, and I can't figure it out why. Any help is
appreicate
File "./run.py", line 193, in ?
print >> htmlFile, "";
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 9:
ordinal not in range(128)
Thanks.
Erik Bethke wrote:
> Hello All,
>
> I still shaking out my last few bugs in my tile matching game:
>
> I am now down to one stumper for me:
> 1) when I initialize wxPython
> 2) from an exe that I have created with py2exe
> 3) when the executable is located on the desktop as opposed to
> somewhe
Hello All,
I still shaking out my last few bugs in my tile matching game:
I am now down to one stumper for me:
1) when I initialize wxPython
2) from an exe that I have created with py2exe
3) when the executable is located on the desktop as opposed to
somewhere on C or D directly
4) when My De
98 matches
Mail list logo