Re: Swapping superclass from a module

2009-05-16 Thread Terry Reedy
Steven D'Aprano wrote: On Sat, 16 May 2009 09:55:39 -0700, Emanuele D'Arrigo wrote: Hi everybody, let's assume I have a module with loads of classes inheriting from one class, from the same module, i.e.: [...] Now, let's also assume that myFile.py cannot be changed or it's impractical to do

ANN: wxPython 2.8.10.1

2009-05-16 Thread Robin Dunn
Announcing -- The 2.8.10.1 release of wxPython is now available for download at http://wxpython.org/download.php. This release fixes the problem with using Python 2.6's default manifest, and updates wxcairo to work with the latest PyCairo. A summary of changes is listed below and also

Re: Context manager, atexit processing, and PEP 3143 DaemonContext.close

2009-05-16 Thread Ben Finney
Carl Banks writes: > I don't think this is anything more than a trivial consideration, Okay, thank you. Anyone else? -- \ “All television is educational television. The question is: | `\ what is it teaching?” —Nicholas Johnson | _o__)

Re: KeyboardInterrupt catch does not shut down the socketserver

2009-05-16 Thread Gabriel Genellina
En Sat, 16 May 2009 04:04:03 -0300, Igor Katson escribió: 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

Re: Context manager, atexit processing, and PEP 3143 DaemonContext.close

2009-05-16 Thread Carl Banks
On May 16, 8:20 pm, Ben Finney wrote: > Carl Banks writes: > > There's already precedent for what to do in the Python library. > > > Python 2.5.2 (r252:60911, Jan  4 2009, 17:40:26) > > [GCC 4.3.2] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > > >>> f = op

Re: Nimrod programming language

2009-05-16 Thread Tomasz Rola
On Mon, 11 May 2009, k...@fiber-space.de wrote: > On 12 Mai, 02:10, Tomasz Rola wrote: > > On Mon, 11 May 2009, rump...@web.de wrote: > > > > One question I ask myself upon seeing a new language is if it is > > > > possible > > > > to program amb (amb=ambiguous) operator in it. This page gives a

Re: Context manager, atexit processing, and PEP 3143 DaemonContext.close

2009-05-16 Thread Ben Finney
Carl Banks writes: > There's already precedent for what to do in the Python library. > > Python 2.5.2 (r252:60911, Jan 4 2009, 17:40:26) > [GCC 4.3.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> f = open('somefile') > >>> f.close() > >>> f.close() >

Re: Context manager, atexit processing, and PEP 3143 DaemonContext.close

2009-05-16 Thread Carl Banks
On May 16, 5:50 pm, Ben Finney wrote: > Ideas? How should this be addressed both Pythonically and respecting the > intent of PEP 3143? There's already precedent for what to do in the Python library. Python 2.5.2 (r252:60911, Jan 4 2009, 17:40:26) [GCC 4.3.2] on linux2 Type "help", "copyright",

Re: UDP reading on multiple sockets

2009-05-16 Thread Grant Edwards
On 2009-05-17, Thomas Vogel wrote: > I'm currently have the problem that I try to read UDP messages from > multiple sockets in parallel. So let's say I get UDP packets from the > same IP on the ports 2000, 2001, 2002,... Is there any reason you can't do it the easy way by using select? http:/

UDP reading on multiple sockets

2009-05-16 Thread Thomas Vogel
Hi all, I'm currently have the problem that I try to read UDP messages from multiple sockets in parallel. So let's say I get UDP packets from the same IP on the ports 2000, 2001, 2002,... Therefore I created the following class. But if I try to instantiate it several times with different port

Re: Swapping superclass from a module

2009-05-16 Thread Steven D'Aprano
On Sat, 16 May 2009 09:55:39 -0700, Emanuele D'Arrigo wrote: > Hi everybody, > > let's assume I have a module with loads of classes inheriting from one > class, from the same module, i.e.: [...] > Now, let's also assume that myFile.py cannot be changed or it's > impractical to do so. Is there a w

Context manager, atexit processing, and PEP 3143 DaemonContext.close

2009-05-16 Thread Ben Finney
Howdy all, I'm slowly developing PEP 3143 and, in parallel, its reference implementation, the ‘python-daemon’ library http://pypi.python.org/pypi/python-daemon/>. Feedback continues to be welcome from people wanting to make a program become a daemon; please try it out and critique the specificatio

Re: Concurrency Email List

2009-05-16 Thread Aahz
[posted and e-mailed] On Sat, May 16, 2009, Pete wrote: > > python-concurre...@googlegroups.com is a new email list for discussion > of concurrency issues in python. It arose out of Dave Beazley's class > on the subject last week: http://www.dabeaz.com/chicago/concurrent.html > > The list wil

Re: Parsing Strings in Enclosed in Curly Braces

2009-05-16 Thread John Machin
On May 17, 1:28 am, a...@pythoncraft.com (Aahz) wrote: > In article > <180531ca-33aa-47b9-9c69-5b5973f6b...@v35g2000pro.googlegroups.com>, > John Machin   wrote: > >Neat trick. However, from 2.6.2: > > help(sum) > >Help on built-in function sum in module __builtin__: > > >sum(...) > >    sum(

Re: Swapping superclass from a module

2009-05-16 Thread Arnaud Delobelle
"Emanuele D'Arrigo" writes: > On May 16, 8:17 pm, Arnaud Delobelle wrote: >> # Insert Wedge into each subclass of modfoo.Base >> for subclass in modfoo.Base.__subclasses__(): >>     if subclass.__module__ != 'modfoo': continue >>     attrs = dict(item for item in subclass.__dict__.items() >>    

Re: Python code-bloat tool-- warning n00b stuff...

2009-05-16 Thread Robert Kern
On 2009-05-16 12:13, anand j wrote: Hi, I am looking for a bunch of rules or a tool that takes the code for my python class and checks the amount of code bloat and points out where i can improve. I am a n00b to python and built an application linking wordnet and graph packages. but somehow h

Re: Swapping superclass from a module

2009-05-16 Thread Emanuele D'Arrigo
On May 16, 8:17 pm, Arnaud Delobelle wrote: > # Insert Wedge into each subclass of modfoo.Base > for subclass in modfoo.Base.__subclasses__(): >     if subclass.__module__ != 'modfoo': continue >     attrs = dict(item for item in subclass.__dict__.items() >                       if item[0][:2] !=

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

2009-05-16 Thread Ned Deily
In article , a...@pythoncraft.com (Aahz) wrote: > In article , > Ned Deily wrote: > >The second example is a call to the built-in function "list", [...] > Actually, list() is not a function: > >>> list > > Rather, ``list`` is an object (specifically a ``type`` object) with a > __call__() meth

Re: Python system with exemplary organization/coding style

2009-05-16 Thread Aahz
In article <2009051416013116807-tomfsess...@gmailcom>, 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: Difference between list() and [] with dictionaries

2009-05-16 Thread Aahz
In article , Ned Deily wrote: >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 li

Re: How to get Exif data from a jpeg file

2009-05-16 Thread Daniel Fetchinson
> I need to get the creation date from a jpeg file in Python. Googling > brought up a several references to apparently defunct modules. The best > way I have been able to find so far is something like this: > > from PIL import Image > img = Image.open('img.jpg') > exif_data = img._getexif() > cre

Re: Options for creating a statistics screen on a Mac with Python?

2009-05-16 Thread Arnaud Delobelle
Phillip B Oldham writes: > On May 16, 2:15 pm, "Diez B. Roggisch" wrote: >> matplotlib should serve you well. > > Thanks, I'll check that out. > >> Or you use some web-based solution with a javascript-based chart library. > > I'd rather stay away from web-based solutions; since this is going to

Re: Swapping superclass from a module

2009-05-16 Thread Arnaud Delobelle
"Emanuele D'Arrigo" writes: > Hi everybody, > > let's assume I have a module with loads of classes inheriting from one > class, from the same module, i.e.: > > ## myFile.py > class SuperClass(object) > class SubClass1(SuperClass) > class SubClass2(SuperClass) > class SubClass3(SuperClass) > > In

Re: Parsing Strings in Enclosed in Curly Braces

2009-05-16 Thread Kay Schluehr
> Since when is a list a number? Perhaps the help needs clarification, > in line with the docs. Everyone is supposed to use reduce() here ;) Kay -- http://mail.python.org/mailman/listinfo/python-list

Re: tarfile doesn't work with tgz files?

2009-05-16 Thread draeath
On 2009-05-16, Robert Dailey wrote: > On May 16, 11:49 am, Gary Herron wrote: >> Robert Dailey wrote: >> > Hi, >> >> > I'm not a big expert on the tarfile component, but I assumed that .tgz >> > files were short for .tar.gz and the format was the same. >> >> That's correct. >> >> > When I try >>

Re: Options for creating a statistics screen on a Mac with Python?

2009-05-16 Thread Nick Craig-Wood
Diez B. Roggisch wrote: > Phillip B Oldham schrieb: > > I've come into possession of a mac mini and a large LCD tv at the > > office. I'd like to set it up in the corner to pull statistics from > > our various servers (load, uptimes, etc) and display them in a > > graphical format, full-screen, w

Re: ConfigParser examples?

2009-05-16 Thread Esmail
Hi Gabriel, Gabriel Genellina wrote: The (excellent!) article series by Doug Hellmann, "Python Module of the Week", covers ConfigParser (and almost the whole standard library by now). http://www.doughellmann.com/PyMOTW Thanks for the pointer, I hadn't come across this site before, it looks

Python code-bloat tool-- warning n00b stuff...

2009-05-16 Thread anand j
Hi, I am looking for a bunch of rules or a tool that takes the code for my python class and checks the amount of code bloat and points out where i can improve. I am a n00b to python and built an application linking wordnet and graph packages. but somehow have this nagging feeling my code is too

Re: tarfile doesn't work with tgz files?

2009-05-16 Thread Robert Dailey
On May 16, 11:49 am, Gary Herron wrote: > Robert Dailey wrote: > > Hi, > > > I'm not a big expert on the tarfile component, but I assumed that .tgz > > files were short for .tar.gz and the format was the same. > > That's correct. > > > When I try > > to extract a .tgz file using tarfile in Python

Re: tarfile doesn't work with tgz files?

2009-05-16 Thread Robert Dailey
On May 16, 11:46 am, Kushal Kumaran wrote: > On Sat, May 16, 2009 at 10:03 PM, Robert Dailey wrote: > > Hi, > > > I'm not a big expert on the tarfile component, but I assumed that .tgz > > files were short for .tar.gz and the format was the same. When I try > > to extract a .tgz file using tarfil

Re: tarfile doesn't work with tgz files?

2009-05-16 Thread Robert Dailey
On May 16, 11:49 am, Gary Herron wrote: > Robert Dailey wrote: > > Hi, > > > I'm not a big expert on the tarfile component, but I assumed that .tgz > > files were short for .tar.gz and the format was the same. > > That's correct. > > > When I try > > to extract a .tgz file using tarfile in Python

Swapping superclass from a module

2009-05-16 Thread Emanuele D'Arrigo
Hi everybody, let's assume I have a module with loads of classes inheriting from one class, from the same module, i.e.: ## myFile.py class SuperClass(object) class SubClass1(SuperClass) class SubClass2(SuperClass) class SubClass3(SuperClass) In a separate file I also have: ## myOtherFile.py cla

Re: tarfile doesn't work with tgz files?

2009-05-16 Thread Robert Dailey
On May 16, 11:33 am, Robert Dailey wrote: > Hi, > > I'm not a big expert on the tarfile component, but I assumed that .tgz > files were short for .tar.gz and the format was the same. When I try > to extract a .tgz file using tarfile in Python 3.0 on Windows, I get > the following error: > >   File

Re: tarfile doesn't work with tgz files?

2009-05-16 Thread Gary Herron
Robert Dailey wrote: Hi, I'm not a big expert on the tarfile component, but I assumed that .tgz files were short for .tar.gz and the format was the same. That's correct. When I try to extract a .tgz file using tarfile in Python 3.0 on Windows, I get the following error: File "C:\Python30

Re: tarfile doesn't work with tgz files?

2009-05-16 Thread Kushal Kumaran
On Sat, May 16, 2009 at 10:03 PM, Robert Dailey wrote: > Hi, > > I'm not a big expert on the tarfile component, but I assumed that .tgz > files were short for .tar.gz and the format was the same. When I try > to extract a .tgz file using tarfile in Python 3.0 on Windows, I get > the following erro

Re: Case insensitive version of string.Template?

2009-05-16 Thread python
Gabriel, If you can guarantee the identifiers are all lowercase inside the dictionary: class lowercase_dict(dict): def __getitem__(self, name): return dict.__getitem__(self, name.lower()) import string values = lowercase_dict( name='John Doe', phone='999-555-1212' ) output = str

tarfile doesn't work with tgz files?

2009-05-16 Thread Robert Dailey
Hi, I'm not a big expert on the tarfile component, but I assumed that .tgz files were short for .tar.gz and the format was the same. When I try to extract a .tgz file using tarfile in Python 3.0 on Windows, I get the following error: File "C:\Python30\lib\tarfile.py", line 1630, in open rai

Re: xml menu pygtk

2009-05-16 Thread Seb
On May 16, 5:04 pm, MRAB wrote: > Seb wrote: > > On May 16, 4:20 pm, MRAB wrote: > >> Seb wrote: > >>> I'm trying to construct a menu from an xml file. However my recursive > >>> algorithm isn't doing what I want it too. I've been starring at this > >>> for too long. Any help appreciated :) > >>>

Re: Parsing Strings in Enclosed in Curly Braces

2009-05-16 Thread Aahz
In article <180531ca-33aa-47b9-9c69-5b5973f6b...@v35g2000pro.googlegroups.com>, John Machin wrote: > >Neat trick. However, from 2.6.2: > help(sum) >Help on built-in function sum in module __builtin__: > >sum(...) >sum(sequence[, start]) -> value > >Returns the sum of a sequence of nu

Re: xml menu pygtk

2009-05-16 Thread Seb
On May 16, 5:04 pm, MRAB wrote: > Seb wrote: > > On May 16, 4:20 pm, MRAB wrote: > >> Seb wrote: > >>> I'm trying to construct a menu from an xml file. However my recursive > >>> algorithm isn't doing what I want it too. I've been starring at this > >>> for too long. Any help appreciated :) > >>>

Re: xml menu pygtk

2009-05-16 Thread MRAB
Seb wrote: On May 16, 4:20 pm, MRAB wrote: Seb wrote: I'm trying to construct a menu from an xml file. However my recursive algorithm isn't doing what I want it too. I've been starring at this for too long. Any help appreciated :) I get the following error but the problem is more of a logical

Re: Options for creating a statistics screen on a Mac with Python?

2009-05-16 Thread Phillip B Oldham
On May 16, 2:15 pm, "Diez B. Roggisch" wrote: > matplotlib should serve you well. Thanks, I'll check that out. > Or you use some web-based solution with a javascript-based chart library. I'd rather stay away from web-based solutions; since this is going to be running 24/7 and has a fixed a scre

Re: xml menu pygtk

2009-05-16 Thread Seb
On May 16, 4:20 pm, MRAB wrote: > Seb wrote: > > I'm trying to construct a menu from an xml file. However my recursive > > algorithm isn't doing what I want it too. I've been starring at this > > for too long. Any help appreciated :) > > > I get the following error but the problem is more of a log

Re: xml menu pygtk

2009-05-16 Thread MRAB
Seb wrote: I'm trying to construct a menu from an xml file. However my recursive algorithm isn't doing what I want it too. I've been starring at this for too long. Any help appreciated :) I get the following error but the problem is more of a logical nature. ./gnomeAppletMenu.py:40: GtkWarning:

xml menu pygtk

2009-05-16 Thread Seb
I'm trying to construct a menu from an xml file. However my recursive algorithm isn't doing what I want it too. I've been starring at this for too long. Any help appreciated :) I get the following error but the problem is more of a logical nature. ./gnomeAppletMenu.py:40: GtkWarning: gtk_menu_shel

Re: open(os.path.join(os.path.dirname(__file__), '../www/bin/picture.png'), 'rb')

2009-05-16 Thread gert
On May 16, 3:40 pm, gert wrote: > On May 16, 3:16 pm, "Diez B. Roggisch" wrote: > > > gert schrieb: > > > > open(os.path.join(os.path.dirname(__file__),'../www/bin/picture.png'), > > > 'rb') > > > how do you do this on windows (py3) so it still works on linux ? > > > os.path.join("..", "www", "bi

Re: open(os.path.join(os.path.dirname(__file__), '../www/bin/picture.png'), 'rb')

2009-05-16 Thread gert
On May 16, 3:16 pm, "Diez B. Roggisch" wrote: > gert schrieb: > > > open(os.path.join(os.path.dirname(__file__),'../www/bin/picture.png'), > > 'rb') > > how do you do this on windows (py3) so it still works on linux ? > > os.path.join("..", "www", "bin", "picture.png") > > Or use os.sep. > > Diez

Re: open(os.path.join(os.path.dirname(__file__), '../www/bin/picture.png'), 'rb')

2009-05-16 Thread MRAB
Diez B. Roggisch wrote: gert schrieb: open(os.path.join(os.path.dirname(__file__),'../www/bin/picture.png'), 'rb') how do you do this on windows (py3) so it still works on linux ? os.path.join("..", "www", "bin", "picture.png") Or use os.sep. Windows should understand '/' as well as '\'. --

Re: open(os.path.join(os.path.dirname(__file__), '../www/bin/picture.png'), 'rb')

2009-05-16 Thread Diez B. Roggisch
gert schrieb: open(os.path.join(os.path.dirname(__file__),'../www/bin/picture.png'), 'rb') how do you do this on windows (py3) so it still works on linux ? os.path.join("..", "www", "bin", "picture.png") Or use os.sep. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Options for creating a statistics screen on a Mac with Python?

2009-05-16 Thread Diez B. Roggisch
Phillip B Oldham schrieb: I've come into possession of a mac mini and a large LCD tv at the office. I'd like to set it up in the corner to pull statistics from our various servers (load, uptimes, etc) and display them in a graphical format, full-screen, with a reasonable refresh rate (say every 3

Generic web parser

2009-05-16 Thread S.Selvam
Hi all, I have to design web parser which will visit the given list of websites and need to fetch a particular set of details. It has to be so generic that even if we add new websites, it must fetch those details if available anywhere. So it must be something like a framework. Though i have done

open(os.path.join(os.path.dirname(__file__), '../www/bin/picture.png'), 'rb')

2009-05-16 Thread gert
open(os.path.join(os.path.dirname(__file__),'../www/bin/picture.png'), 'rb') how do you do this on windows (py3) so it still works on linux ? -- http://mail.python.org/mailman/listinfo/python-list

Options for creating a statistics screen on a Mac with Python?

2009-05-16 Thread Phillip B Oldham
I've come into possession of a mac mini and a large LCD tv at the office. I'd like to set it up in the corner to pull statistics from our various servers (load, uptimes, etc) and display them in a graphical format, full-screen, with a reasonable refresh rate (say every 30 seconds). There will be qu

using Winpdb in an embedded python interpreter

2009-05-16 Thread Adrian Genaid
Hi there, I have a problem using Winpdb in Pythonscripts running in a program which uses an embedded Python interpreter. After linking all needed modules statically to python, "import rpdb2" can be done and leads to no error. But on using the next line "rpdb2.start_embedded_debugger('password')".

How to get Exif data from a jpeg file

2009-05-16 Thread Arnaud Delobelle
Hi all, I need to get the creation date from a jpeg file in Python. Googling brought up a several references to apparently defunct modules. The best way I have been able to find so far is something like this: from PIL import Image img = Image.open('img.jpg') exif_data = img._getexif() creation_

Re: Need advice on distributing small module

2009-05-16 Thread Nick Craig-Wood
kj wrote: > The module has only one non-standard dependency, described by the > following code: > > if sys.version_info[:2] >= (2, 6): > import json > else: > import simplejson as json I think try: import json except ImportError: import simplejson as json Is more pythonic

Re: Appending traceback from exception in child thread

2009-05-16 Thread Edd
On May 16, 4:02 am, "Gabriel Genellina" wrote: > You could use the 3-argument form of the raise > statement:http://docs.python.org/reference/simple_stmts.html#the-raise-statement Ah! When did that get there? :) > There is a problem: remember that the traceback object keeps a reference   > to a

Re: Appending traceback from exception in child thread

2009-05-16 Thread Diez B. Roggisch
Edd schrieb: Hi folks, I have a some threadpool code that works like this : tp = ThreadPool(number_of_threads) futures = [tp.future(t) for t in tasks] # each task is callable for f in futures: print f.value() # <-- may propagate an exception The idea being that a Future obj

Re: KeyboardInterrupt catch does not shut down the socketserver

2009-05-16 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