Re: exceptions and unicode

2010-06-19 Thread Stuart McGraw
On 06/16/2010 03:51 PM, Thomas Jollans wrote: > On 06/16/2010 10:10 PM, Stuart McGraw wrote: >> Note that the exceptions may be anything (I just used IOError >> as an example) and are generated in bowels of an API that I >> can't/won't mess with. > > Yeah, w

Re: exceptions and unicode

2010-06-19 Thread Stuart McGraw
On 06/16/2010 03:53 PM, Martin v. Loewis wrote: >> So how do I get what I want? > > Submit a patch. You would have to explain why this is a bug fix and not > a new feature, as new features are not allowed anymore for 2.x. Thanks. Actually I have no idea if this is a bug or a feature (despite r

exceptions and unicode

2010-06-16 Thread Stuart McGraw
I am having a problem with exceptions and unicode. try: open ('file.txt') except IOError, e: pass str (e) => "[Errno 2] No such file or directory: 'file.txt'" which is fine but... try: open (u'フィイル.txt') except IOError, e: pass str (e) => "[Errno 2] No such file or directory: u'\

Re: does raw_input() return unicode?

2006-10-10 Thread Stuart McGraw
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Stuart McGraw schrieb: > > So, does raw_input() ever return unicode objects and if > > so, under what conditions? > > At the moment, it only returns unicode objects when invoked

does raw_input() return unicode?

2006-10-09 Thread Stuart McGraw
In the announcement for Python-2.3 http://groups.google.com/group/comp.lang.python/msg/287e94d9fe25388d?hl=en it says "raw_input(): can now return Unicode objects". But I didn't see anything about this in Andrew Kuchling's "2.3 What's New", nor does the current python docs for raw_input() say an

Re: elementtree: line numbers and iterparse

2006-09-12 Thread Stuart McGraw
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Stuart McGraw wrote: > > Now I find i need to get and save the input file line > > number of each node. Googling turned up a way > > to do it by subclassing FancyTreeBuilder

elementtree: line numbers and iterparse

2006-09-12 Thread Stuart McGraw
I have a broad (~200K nodes) but shallow xml file I want to parse with Elementtree. There are too many nodes to read into memory simultaneously so I use iterparse() to process each node sequentially. Now I find i need to get and save the input file line number of each node. Googling turned up

Re: bizarre id() results

2005-12-15 Thread Stuart McGraw
"Delaney, Timothy (Tim)" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] and several other people responded with similar information. [...] Bound methods are created on the fly. [...] Ahhh! That was the piece I was missing. Thank you all! -- http://mail.python.org/mailman/listinf

bizarre id() results

2005-12-15 Thread Stuart McGraw
The following was cut and pasted exactly (except for the # lines which I added after the fact) from an interactive python session in a Window 2000 cmd.exe window. Can somebody please explain to me what the heck is going on?!?! Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (I

Re: Why are there no ordered dictionaries?

2005-11-22 Thread Stuart McGraw
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Stuart McGraw wrote > > > > What would improve the Cheese Shop's interface for you? > > > > Getting rid of those damn top level links to old versions. > > Seeing

Re: Why are there no ordered dictionaries?

2005-11-22 Thread Stuart McGraw
"A.M. Kuchling" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [...] > What would improve the Cheese Shop's interface for you? Getting rid of those damn top level links to old versions. Seeing a long list of old versions, when 99% of visitors are only interested in the current vers

Re: Python Book

2005-11-13 Thread Stuart McGraw
"Stuart McGraw" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > David Beasley's Essential Python (New Riders). It's a little dated > now (covers only up to version 2.2) [...] Oops, that should be "Beazley", "Python Ess

Re: Python Book

2005-11-13 Thread Stuart McGraw
David Beasley's Essential Python (New Riders). It's a little dated now (covers only up to version 2.2) but lucid, consise, well organized. It restricts itself to Python's syntax and semantics and does not waste time explaining basic programming concepts. I made several attempts to learn Python bu

Re: wxpython - passing arg to wx.app OnInit

2005-10-23 Thread Stuart McGraw
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Stuart McGraw wrote: > > I have a wxPython app, conventionally structured > > with a Application class derived from wx.App. > > My problem is that the app accepts a command >

wxpython - passing arg to wx.app OnInit

2005-10-22 Thread Stuart McGraw
I have a wxPython app, conventionally structured with a Application class derived from wx.App. My problem is that the app accepts a command line argument that must be acted upon within the OnInit() method of the Application class. How do I pass it cleanly from main() into app.OnInit()? In the si

Tix example code?

2005-07-13 Thread Stuart McGraw
I am having trouble trying to figure out how to use Tix widgets in a Python program. The documentation is scanty and in TCL syntax with no examples. Specifically, I'm trying to use a Tix ComboBox widget and haven't been able to figure out how to initialize the set of values in the widget's lis