Re: Parsing Strings in Enclosed in Curly Braces

2009-05-15 Thread John Machin
On May 16, 3:25 am, MRAB wrote: > Chris Rebert wrote: > > On Fri, May 15, 2009 at 9:12 AM,   wrote: > >> How do you parse a string enclosed in Curly Braces? > > >> For instance: > > >> x = "{ABC EFG IJK LMN OPQ}" > > >> I want to do x.split('{} ') and it does not work. Why does it not work > >> an

Photoimage on button appears pixelated when button is disabled

2009-05-15 Thread Dustan
In tkinter, when I place a photoimage on a button and disable the button, the image has background dots scattered through the image. Searching the web, I wasn't able to find any documentation on this behavior, nor how to turn it off. So here I am. How do I keep this from happening? Also, how can I

Re: How to catch str exception?

2009-05-15 Thread Rhodri James
On Fri, 15 May 2009 12:50:59 +0100, anuraguni...@yahoo.com wrote: try:     raise "abc" except:     e, t, tb = sys.exc_info()     if not isinstance(e, str):         raise     print "caught", e This seems to be the solution, thanks Do be aware that string exceptions are going away, so at

Re: How to catch str exception?

2009-05-15 Thread Cameron Simpson
On 15May2009 13:36, <> wrote: | "anuraguni...@yahoo.com" writes: | > there are many such exceptions and hence it is not feasible to catch | > them all or know them all unless i go thru src code. | | But that is true of all exceptions. The alternative seems to be a | "checked exception" scheme l

Re: How to get the formal args of a function object?

2009-05-15 Thread kj
In Chris Rebert writes: >Take a look at inspect.getargspec(func): >http://docs.python.org/library/inspect.html#inspect.getargspec Thank you much, that did the trick. And inspect is a very handy module to know about. kynn -- NOTE: In my address everything before the first period is backwards

Re: Parsing Strings in Enclosed in Curly Braces

2009-05-15 Thread Rhodri James
On Fri, 15 May 2009 17:12:24 +0100, wrote: How do you parse a string enclosed in Curly Braces? For instance: x = "{ABC EFG IJK LMN OPQ}" I want to do x.split('{} ') and it does not work. Why does it not work and what are EXCEPTIONS to using the split method? Other people have already done

Re: Need advice on distributing small module

2009-05-15 Thread kj
In <99246143-a853-4041-bc45-eeb648388...@r3g2000vbp.googlegroups.com> Carl Banks writes: >On May 14, 1:26=A0pm, kj wrote: >> I've written a tiny module that I'd like to make available online >> from my website. =A0This module is not "production-grade" code; it >> is meant only as an illustratio

Re: python

2009-05-15 Thread Rhodri James
On Fri, 15 May 2009 14:58:16 +0100, wrote: hello, I´m a student of linguistic an I need do this exercises. Can anybody help me,please? Thanks Sorry, we're allergic to homework. If you've got any more specific questions about how bits of Python work, do ask, but don't ask us to do your assign

ANN: ActivePython 2.6.2.2, 3.1.0b1.0, 2.5.4.4 is now available

2009-05-15 Thread Sridhar Ratnakumar
I'm happy to announce that ActivePython 2.6.2.2, 3.1.0b1.0 and 2.5.4.4 are now available for download from: http://www.activestate.com/activepython/ This is a patch release that updates ActivePython to core Python 2.6.2 and 3.1b2. This release also contains updates to Tcl/Tk 8.5.7 and Tix 8

Re: Configure options for minimal Python 2.6

2009-05-15 Thread Martin v. Löwis
> I want to compile a minimal Python 2.6 for Debian Etch without support > for optional features such as tk and sphinx. The configure script's > help says that features can be disabled with an '--without-PACKAGE', so > I guess disabling tk is '--without-tk', but where is there a list of the > feat

Re: Just wondering

2009-05-15 Thread Dave Angel
norseman wrote: Marco Mariani wrote: Gediminas Kregzde wrote: def doit(i): pass def main(): a = [0] * 1000 t = time() map(doit, a) print "map time: " + str(time() - t) Here you are calling a function ten million times, build a list with of ten million None results, then

Re: KeyboardInterrupt catch does not shut down the socketserver

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 09:04:05 -0300, Igor Katson escribió: Lawrence D'Oliveiro wrote: In message , Igor Katson wrote: Lawrence D'Oliveiro wrote: In message , Igor Katson wrote: I have problems in getting a SocketServer to shutdown. Do you want to do a shutdown or a close? I want the se

Annoying feedparser issues

2009-05-15 Thread John Nagle
This really isn't the fault of the "feedparser" module, but it's worth mentioning. I have an application which needs to read each new item from a feed as it shows up, as efficiently as possible, because it's monitoring multiple feeds. I want exactly one copy of each item as it comes in.

Difference between list() and [] with dictionaries

2009-05-15 Thread Sam Tregar
Hello all. Can anyone explain why this creates a list containing a dictionary: [{'a': 'b', 'foo': 'bar'}] But this creates a list of keys of the dictionary: list({ "a": "b", "foo": "bar" }) I expected them to be equivalent but clearly they're not! I'm using Python 2.6.1 if that helps. -s

Re: Tkinter Window On Top

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 16:39:41 -0300, Trevor escribió: Can a Tkinter application create a COM object and keep its own window on top of it? excel = win32com.client.Dispatch('Excel.Application') I would like the user to be able to see and interact with the Excel application but keep the Tkinter

Re: using urlretrive/urlopen

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 12:03:09 -0300, Rustom Mody escribió: I am trying to talk to a server that runs on localhost The server runs on http://localhost:7000/ and that opens alright in  a web browser. However if I use urlopen or urlretrieve what I get is this 'file' -- obviously not the one that

Re: How do i generate a tuple from a generator ?

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 17:58:55 -0300, eye zak escribió: I have a situation where i want a tuple from a generator/sequence comprehension. I am wondering, is this possible ? or is this just a bad idea all together? class iterator(object): __slots__ = ('__iters',) def __init__(self,*a

WinAppDbg module v1.1 is out!

2009-05-15 Thread Mario Alejandro Vilas Jerez
What is WinAppDbg? == The WinAppDbg python module allows developers to quickly code instrumentation scripts in Python under a Windows environment. It uses ctypes to wrap many Win32 API calls related to debugging, and provides an object-oriented abstraction layer to manipulate thre

Re: Appending traceback from exception in child thread

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 15:09:45 -0300, Edd escribió: As the comment on the last line indicates, looking at the .value() of a Future may give the return value of the associated task, or it may also propagate an exception that was raised in a child thread. Inside the implementation I store caught e

Re: Difference between list() and [] with dictionaries

2009-05-15 Thread Ned Deily
In article , Sam Tregar wrote: > Can anyone explain why this creates a list containing a > dictionary: > [{'a': 'b', 'foo': 'bar'}] > But this creates a list of keys of the dictionary: > list({ "a": "b", "foo": "bar" }) The first example is a list, expressed as a list display literal, con

Re: Case insensitive version of string.Template?

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 12:35:09 -0300, escribió: Using Python 2.6 or higher: Is there a way to configure string.Template() to ignore the case of matched identifiers? In other words, given the following Template string and dictionary where all keys are lowercase, is there a way to have my identifie

Re: Difference between list() and [] with dictionaries

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 22:17:43 -0300, Sam Tregar escribió: Hello all. Can anyone explain why this creates a list containing a dictionary: [{'a': 'b', 'foo': 'bar'}] But this creates a list of keys of the dictionary: list({ "a": "b", "foo": "bar" }) I expected them to be equivalent but cl

Re: ConfigParser examples?

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 18:32:57 -0300, Esmail escribió: Can anyone point to on the web, or possibly share a simple example of the use of the ConfigParser module? The (excellent!) article series by Doug Hellmann, "Python Module of the Week", covers ConfigParser (and almost the whole standard li

Re: python copy method alters type

2009-05-15 Thread greg
Zhenhai Zhang wrote: a: ['a', 1, 3, 4] c: ['c' '2' '3' '4'] The lack of commas here suggests that c is actually a numpy array rather than a list. Did you import copy from Numeric or numpy, by any chance? The following experiment reproduces your result: >>> import numpy >>> a = ['a', 1, 2, 3

Re: Python system with exemplary organization/coding style

2009-05-15 Thread TomF
On 2009-05-14 16:18:07 -0700, CTO said: On May 14, 7:01 pm, TomF wrote: I'm looking for a medium-sized Python system with very good coding style and good code organization, so I can learn from it.  I'm reading various books on Python with advice on such things but I'd prefer to see a real sys

Re: KeyboardInterrupt catch does not shut down the socketserver

2009-05-15 Thread Igor Katson
Gabriel Genellina wrote: En Fri, 15 May 2009 09:04:05 -0300, Igor Katson escribió: Lawrence D'Oliveiro wrote: In message , Igor Katson wrote: Lawrence D'Oliveiro wrote: In message , Igor Katson wrote: I have problems in getting a SocketServer to shutdown. Do you want to do a shutdown or

<    1   2