Re: Is it possible to consume UTF8 XML documents using xml.dom.pulldom?

2008-07-30 Thread Simon Willison
On Jul 30, 4:59 pm, Simon Willison <[EMAIL PROTECTED]> wrote: > I just tried it out on Python 2.4.2 on an Ubuntu machine and it worked > fine! I guess this must be an OS X Python bug. How absolutely > infuriating. Some very useful people in #python on Freenode pointed out tha

Re: Is it possible to consume UTF8 XML documents using xml.dom.pulldom?

2008-07-30 Thread Simon Willison
On Jul 30, 4:43 pm, Paul Boddie <[EMAIL PROTECTED]> wrote: > I can't reproduce this on Python 2.3.6 or 2.4.4 on RHEL 4. Instead, I > get the usual... > > ('CHARACTERS', ) I'm using Python 2.5.1 on OS X Leopard: $ python Python 2.5.1 (r251:54863, Feb 4 2008, 21:48:13) [GCC 4.0.1 (Apple Inc. build

Re: Is it possible to consume UTF8 XML documents using xml.dom.pulldom?

2008-07-30 Thread Simon Willison
Follow up question: what's the best way of incrementally consuming XML in Python that's character encoding aware? I have a very large file to consume but I'd rather not have to fall back to the raw SAX API. -- http://mail.python.org/mailman/listinfo/python-list

Is it possible to consume UTF8 XML documents using xml.dom.pulldom?

2008-07-30 Thread Simon Willison
g) --> 348 buf = StringIO(string) 349 if not parser: 350 parser = xml.sax.make_parser() UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 32: ordinal not in range(128) Is it possible to consume utf8 or unicode using xml.dom.pulldom or should I try something else? Thanks, Simon Willison -- http://mail.python.org/mailman/listinfo/python-list

Treating a unicode string as latin-1

2008-01-03 Thread Simon Willison
in range(128) How can I tell Python "I know this says it's a unicode string, but I need you to treat it like a bytestring"? Thanks, Simon Willison -- http://mail.python.org/mailman/listinfo/python-list

Pythonic API design: detailed errors when you usually don't care

2006-10-02 Thread Simon Willison
Hi all, I have an API design question. I'm writing a function that can either succeed or fail. Most of the time the code calling the function won't care about the reason for the failure, but very occasionally it will. I can see a number of ways of doing this, but none of them feel aesthetically p

Re: CENSORSHIP - Django Project (Schema Evolution Support)

2006-06-07 Thread Simon Willison
Ilias Lazaridis wrote: > [posted publicly to comp.lang.python, with email notification to 6 > recipients relevant to the topic] > > I have implemented a simple schema evolution support for django, due to > a need for a personal project. Additionally, I've provided an Audit: > > http://case.lazaridi