Re: [Python-Dev] To 3.0.2 or not to 3.0.2?

2009-02-16 Thread Lennart Regebro
On Tue, Feb 17, 2009 at 00:50, Guido van Rossum wrote: > Can you explain the difficulty with porting setuptools in more detail? Oh, it just exposes a bug in distutils. It probably means I'll have to make a test for python version, and if it is 3.0.1, monkey-patch distutils. I haven't really looke

Thread control in thread pool for sending

2009-02-16 Thread testisok
Hi, all: Here is a thread pool for sending as a client, all blocked at Semaphore. How can I choose these threads that is idle for some time and then send heartbeat messages to the server thru sockets of these threads? Thanks in advance. Best wishes -- http://mail.python.org/mailman/list

Re: memory recycling/garbage collecting problem

2009-02-16 Thread Marc 'BlackJack' Rintsch
On Mon, 16 Feb 2009 23:21:16 -0600, Yuanxin Xi wrote: > I'm having some problems with the memory recycling/garbage collecting of > the following testing code: > a=[str(i) for i in xrange(1000)] > This takes 635m/552m/2044 memory (VIRT/RES/SHR) > b={} for i in xrange(1000):

Re: Found a very nice, small, cross-platform GUI toolkit for Python.

2009-02-16 Thread laplacian42
On Feb 17, 1:21 am, Python Nutter wrote: > > Note: spelling is "OcempGUI". Also, since google broke some of the > > links, > > here's that main link again: > > Thats my bad or more to the point my iPhone bad, typing fast with > spellcheck changes words to real dictionary words. > > > Well, to be f

Re: Pythonic way to determine if a string is a number

2009-02-16 Thread Paddy
On Feb 15, 5:46 pm, pyt...@bdurham.com wrote: > What's the Pythonic way to determine if a string is a number? By > number I mean a valid integer or float. > > I searched the string and cMath libraries for a similar function > without success. I can think of at least 3 or 4 ways to build my > own fu

Re: Will multithreading make python less popular?

2009-02-16 Thread Paddy
On Feb 16, 9:34 am, rushen...@gmail.com wrote: > Hi everybody, > I am an engineer. I am trying to improve my software development > abilities. I have started programming with ruby. I like it very much > but i want to add something more. According to my previous research i > have designed a learning

Re: Found a very nice, small, cross-platform GUI toolkit for Python.

2009-02-16 Thread Python Nutter
> Note: spelling is "OcempGUI". Also, since google broke some of the > links, > here's that main link again: Thats my bad or more to the point my iPhone bad, typing fast with spellcheck changes words to real dictionary words. > Well, to be fair, SDL is pretty commonly-used software and they offe

pythonic array subsetting

2009-02-16 Thread Nick Matzke
Hi, So I've got a square floating point array that is about 1000 x 1000. I need to subset this array as efficiently as possible based on an ordered sublist of the list of rownames/colnames (they are the same, this is a symmetric array). e.g., if sublist is of length 500, and matches the ro

Re: Need an application sends from paricular port

2009-02-16 Thread Sambit Samal
Hi > > I am new to Python world > > I need a python script , which binds at a user defind port & sends to > other enity , which waits at particular port. > The other enity will respond & Python script should receive that at the > defined port > > The communication will happen over UDP > > e.g > >

Re: memory recycling/garbage collecting problem

2009-02-16 Thread Chris Rebert
On Mon, Feb 16, 2009 at 9:21 PM, Yuanxin Xi wrote: > I'm having some problems with the memory recycling/garbage collecting > of the following testing code: > a=[str(i) for i in xrange(1000)] > This takes 635m/552m/2044 memory (VIRT/RES/SHR) > b={} for i in xrange(1000): > ..

memory recycling/garbage collecting problem

2009-02-16 Thread Yuanxin Xi
I'm having some problems with the memory recycling/garbage collecting of the following testing code: >>> a=[str(i) for i in xrange(1000)] This takes 635m/552m/2044 memory (VIRT/RES/SHR) >>> b={} >>> for i in xrange(1000): ... b[str(i)]=i Then the memory usage increased to 1726m/1.6g/

Re: Module to read/write MIDI ?

2009-02-16 Thread Peter Billam
On 2009-02-16, Tim Wintle wrote: >> I had my first look around pypi.python.org/pypi yesterday and didn't >> see anything. Is there a MIDI-module for Python ? If not, I'll >> email Sean to ask if he'd mind me translating his module into Python3... > >

printing bytes to stdout in Py3

2009-02-16 Thread Peter Billam
Greetings. (Newbie warning as usual) In Python3, sys.stdout is a io.TextIOWrapper object; but I want to output bytes (e.g. muscript -midi t > t.mid ) and they're coming out stringified :-( How can I either change the encoding on sys.stdout, or close sys.stdout and reopen it in 'b' mode, or dup(f

Re: Will multithreading make python less popular?

2009-02-16 Thread Michele Simionato
On Feb 16, 10:20 pm, rushen...@gmail.com wrote: > Hi again > > OpenERP and ERP5 was written in python as i know. I really wonder how > they do this without threads. I want to see a real time graph at the > same time while i am working on the same screen. What is the secret? > > Thanks > Rushen Her

Re: How to verify whether a process got hanged or still alive.

2009-02-16 Thread Giampaolo Rodola'
On 16 Gen, 00:04, neel wrote: > Hi There, > > I want to check the health of IEprocessusing python. I am running an > application on IE. I have to verify that the application is not > crashing the IE. Is there any module which can help me in getting > theprocessstatus? > > Thanks, > Neel By proc

Re: Will multithreading make python less popular?

2009-02-16 Thread Ben Finney
a...@pythoncraft.com (Aahz) writes: > In article , > Hendrik van Rooyen wrote: > >Occam was the language that should have won the marketing prize, > >but didn't. > > It wasn't simple enough. *bdom-tsssh* http://en.wikipedia.org/wiki/Occam's_razor> -- \ “I guess we were all guilty, in a

Re: Will multithreading make python less popular?

2009-02-16 Thread Aahz
In article , Hendrik van Rooyen wrote: > >Occam was the language that should have won the marketing prize, but >didn't. It wasn't simple enough. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ Weinberg's Second Law: If builders built buildings the way programmer

Re: Changing the Image on a button

2009-02-16 Thread odeits
On Feb 16, 8:40 am, John Posner wrote: >  >> from Tkinter import * >  >> >  >> def do(): >  >>     btn.configure(image = None) >  >> >  >> root = Tk() >  >> img1 = PhotoImage(file="bacon.gif") >  >> >  >> btn = Button(image = img1, command = do, text = "hello" ) >  >> btn.img = img1 >  >> btn.pack

Re: flexible find and replace ?

2009-02-16 Thread John Machin
On Feb 17, 7:10 am, OdarR wrote: > Hi guys, > > how would you do a clever find and replace, where the value replacing > the tag > is changing on each occurence ? > > "...TAGTAGTAG..TAG." > > is replaced by this : > > "...REPL01REPL02.

Re: [Python-Dev] To 3.0.2 or not to 3.0.2?

2009-02-16 Thread Calvin Spealman
FWIW; I think a 3.0.2 would be useful socially (even volunteer projects have marketting issues to consider). It says "we are committed to making 3.x work", while the quick jump to 3.1 with only a limited minor fix release to 3.0 says "we stumbled into this and have to just brush this under the rug.

Re: Threads in PyGTK: keep typing while ping-ing

2009-02-16 Thread Mamahita Sela
Dear FB, > As you have been already told, join() blocks until the > thread is > terminated. and you should avoid that. > A simple fix could by add a timeout to t.join, doing > something like : > t.join(JOIN_TIMEOUT); > if not t.isAlive(): > print t.result > Thanks for

Problems with OS X 10.5.6 and Python 2.5 and GDAL 1.6

2009-02-16 Thread Helly John J.
Hi. I'm a newbie to python and am running: OS X 10.5.6 Python 2.5.4 and have run easy_install for gdal like this: /Library/Python/2.5/site-packages>sudo easy_install GDAL Password: Searching for GDAL Best match: GDAL 1.6.0 Processing GDAL-1.6.0-py2.5-macosx-10.5-i386.egg GDAL 1.6.0 is already

Re: [Python-Dev] To 3.0.2 or not to 3.0.2?

2009-02-16 Thread Benjamin Peterson
On Mon, Feb 16, 2009 at 5:50 PM, Guido van Rossum wrote: > Can you explain the difficulty with porting setuptools in more detail? Basically setuptools invokes a functions in distutils that was still using cmp(). (See the latest messages in issue #1717 for all the details.) -- Regards, Benjami

Re: tkinter in python30

2009-02-16 Thread Chris Rebert
On Mon, Feb 16, 2009 at 5:07 PM, wrote: > On Feb 16, 7:46 pm, kentand...@sbcglobal.net wrote: >> Does anyone know what happened to tkinter in Python3? There is a tkinter >> folder in the Lib folder, but there is no Tkinter.py that I can >> find. Both "from Tkinter import *" and "from _tkinter imp

Re: Referencing resources from python

2009-02-16 Thread Rhodri James
On Tue, 17 Feb 2009 00:41:26 -, Noam Aigerman wrote: Hi, What is the best way to reference a non-python file's path from inside python ? Until now, I (stupidly) had such lines as: theFile=open('../somefile.txt') in my python files. Now I moved my python files to another dir, and a

What are your favorite Python features?

2009-02-16 Thread Tony Arcieri
I'm creating a new language which borrows from Python (among other languages), and I'm curious what features of Python its users enjoy the most. I posted a similar thread on ruby-talk with a poll, but unfortunately my background in Python is much weaker than it is in Ruby. That said, here are som

Re: tkinter in python30

2009-02-16 Thread laplacian42
On Feb 16, 7:46 pm, kentand...@sbcglobal.net wrote: > Does anyone know what happened to tkinter in Python3? There is a tkinter > folder in the Lib folder, but there is no Tkinter.py that I can > find. Both "from Tkinter import *" and "from _tkinter import *" result > in "no such module" error messa

Re: Speedup Bitmap Parser

2009-02-16 Thread bearophileHUGS
Jayson Santos: > Do I need use some patters or others progamming conventions ? That's a strong question... Knowing OOP well is important, and it's often a good way to program, etc. But... You may try to rewrite your code with functions only and no classes (well, you may need to use classes for the

tkinter in python30

2009-02-16 Thread kentandkat
Does anyone know what happened to tkinter in Python3? There is a tkinter folder in the Lib folder, but there is no Tkinter.py that I can find. Both "from Tkinter import *" and "from _tkinter import *" result in "no such module" error messages. What gives? Kent -- http://mail.python.org/mailman/lis

Referencing resources from python

2009-02-16 Thread Noam Aigerman
Hi, What is the best way to reference a non-python file's path from inside python ? Until now, I (stupidly) had such lines as: theFile=open('../somefile.txt') in my python files. Now I moved my python files to another dir, and all those relative filenames broke. On the other hand, the

Re: time.strptime() and time.strftime() reciprocity

2009-02-16 Thread Denis Kasak
On Mon, Feb 16, 2009 at 11:57 PM, Greg Krohn wrote: > ActivePython 2.6.1.1 (ActiveState Software Inc.) based on > Python 2.6.1 (r261:67515, Dec 5 2008, 13:58:38) [MSC v.1500 32 bit (Intel)] > on > win32 > Type "help", "copyright", "credits" or "license" for more information. import time >

Re: Speedup Bitmap Parser

2009-02-16 Thread Jayson Santos
On 16 fev, 20:41, bearophileh...@lycos.com wrote: > Jayson Santos: > > > Here is the new code using your changeshttp://pastebin.com/m6dfe619d > > And here is the profilerhttp://pastebin.com/m74d282b8 > > I have suggested you to profile the program mostly for pedagogical > purposes, it's often a goo

Re: Speedup Bitmap Parser

2009-02-16 Thread bearophileHUGS
Jayson Santos: > Here is the new code using your changeshttp://pastebin.com/m6dfe619d > And here is the profilerhttp://pastebin.com/m74d282b8 I have suggested you to profile the program mostly for pedagogical purposes, it's often a good thing to do if you want to speed up a program. But now it's y

Re: wxPython and Croatian characters

2009-02-16 Thread alejandro
Provjeri da si nisi stavio ansii kada si instalirao wx.python. Mozes probat ubacit iznad svega u fajlu komentar u kojem pise da je fajl u UTF-8 i onda bi ti trebalo sljakat. Nadem sutra pa ti posaljem -- http://mail.python.org/mailman/listinfo/python-list

Re: Speedup Bitmap Parser

2009-02-16 Thread Jayson Santos
On 16 fev, 18:29, bearophileh...@lycos.com wrote: > Jayson Santos: > > > Hello people, I'm writing a Bitmap parser for study purposes, > > This code: > >         x = 0 >         y = 0 >         for line in bmp.bitmap_lines.lines: >             for color in xrange(len(line.colors)): >              

time.strptime() and time.strftime() reciprocity

2009-02-16 Thread Greg Krohn
[Apologies for the use of "reciprocity" in the subject - it's a little pompous, I know, but it fits so well. :)] Hello c.l.python! I'm trying to parse some dates of the form "01/29/09 12:55 PM" from a CSV file, but I'm having trouble with the format string in time.strptime() . In testing this

Re: wxPython and Croatian characters

2009-02-16 Thread Martin v. Löwis
>> Unless you are using python 3.0 (which I doubt, afaik no wx available), >> your above coding declaration is useless for the shown piece of code, as >> it only applies to unicode literals, which are written with a preceding u. >> > > No. The coding declaration does nothing to unicode literals

Re: wxPython and Croatian characters

2009-02-16 Thread J. Cliff Dyer
On Mon, 2009-02-16 at 20:06 +0100, Diez B. Roggisch wrote: > vedrandeko...@gmail.com schrieb: > > Hello, > > > > I have problem with configuring my wxPython script to work with > > Croatian characters like: đ,š,ž,č,ć. > > Here is my simple script without wxPython (this script works): > > > >

Re: Found a very nice, small, cross-platform GUI toolkit for Python.

2009-02-16 Thread Dotan Cohen
> Interesting! One of the commercial apps I'm involved (C++ not python) > in uses SDL as its GUI with windows etc built on top of it. It means > that it looks exactly the same on all supported platforms and since it > usually runs full screen that is fine. I imagine this GUI toolkit > fits the s

Re: Found a very nice, small, cross-platform GUI toolkit for Python.

2009-02-16 Thread laplacian42
On Feb 16, 4:31 pm, Nick Craig-Wood wrote: > > Interesting!  One of the commercial apps I'm involved (C++ not python) > in uses SDL as its GUI with windows etc built on top of it.  It means > that it looks exactly the same on all supported platforms and since it > usually runs full screen that is

Re: flexible find and replace ?

2009-02-16 Thread Tim Chase
how would you do a clever find and replace, where the value replacing the tag is changing on each occurence ? "...TAGTAGTAG..TAG." is replaced by this : "...REPL01REPL02REPL03..REPL04..." This is a variant o

Re: Pythonic way to determine if a string is a number

2009-02-16 Thread Nick Craig-Wood
pyt...@bdurham.com wrote: > Thanks for everyone's feedback. I believe my original post's code > (updated following my signature) was in line with this list's feedback. > > Christian: Thanks for reminding me about exponential formats. My updated > code accounts for these type of numbers. I don

Re: Found a very nice, small, cross-platform GUI toolkit for Python.

2009-02-16 Thread Nick Craig-Wood
laplacia...@gmail.com wrote: > I think I just found the GUI toolkit for Python I've been searching > for. It seems to meet all of the following requirements: > >* free software >* small (I don't need batteries -- Python already comes with those.) >* easy to use >* actively maint

Re: Speedup Bitmap Parser

2009-02-16 Thread bearophileHUGS
Jayson Santos: > Hello people, I'm writing a Bitmap parser for study purposes, This code: x = 0 y = 0 for line in bmp.bitmap_lines.lines: for color in xrange(len(line.colors)): canvas.create_line(x, y, x+1, y, fill="#%02x%02x%02x" % (line.colors

Re: Regarding Joystick

2009-02-16 Thread shreyas shah
Hi , I have figured out a code with the help of archives in pygame can anyone help me with controlling the speed of joystick ... i am going to integrate joystick with a PTZ camera ... i was wondering if there are any functions which can help me control the speed of camera and by controlling

Re: Will multithreading make python less popular?

2009-02-16 Thread rushenaly
Hi again OpenERP and ERP5 was written in python as i know. I really wonder how they do this without threads. I want to see a real time graph at the same time while i am working on the same screen. What is the secret? Thanks Rushen -- http://mail.python.org/mailman/listinfo/python-list

Re: Speedup Bitmap Parser

2009-02-16 Thread Terry Reedy
Jayson Santos wrote: Hello people, I'm writing a Bitmap parser for study purposes, however when I parse a bitmap file and when I paint that file in a window, the script take to much time. 1. You turned constants into static methods called for every line, adding attribute lookup and function ca

Re: Creating custom formatter function

2009-02-16 Thread Terry Reedy
Garrett Cooper wrote: Hello Python folks, I have a function where I'd like to prefix a format string via a `prefix' string. The definition of the base method is as follows: #START CODE def print_message(prefix, out_stream, fmt, *args, **kwargs): """ Print out [prefix]: [message] """

Re: explain

2009-02-16 Thread Terry Reedy
Jeroen Ruigrok van der Werven wrote: -On [20090216 11:17], Saeed Iravani (si.4...@yahoo.com) wrote: I download python 2.5.4 and install but I dont know that how perform python? I dont know from which directory perform python? It would help if you would clarify which operating system you are

Re: wxPython and Croatian characters

2009-02-16 Thread Jason Scheirer
On Feb 16, 10:58 am, vedrandeko...@gmail.com wrote: > Hello, > > I have problem with configuring my wxPython script to work with > Croatian characters like:  ð,¹,¾,è,æ. > Here is my simple script without wxPython (this script works): > >       # -*- coding: utf-8 -*- >       s = "hello normal strin

Re: flexible find and replace ?

2009-02-16 Thread Jason Scheirer
On Feb 16, 12:10 pm, OdarR wrote: > Hi guys, > > how would you do a clever find and replace, where the value replacing > the tag > is changing on each occurence ? > > "...TAGTAGTAG..TAG." > > is replaced by this : > > "...REPL01REPL02

Re: flexible find and replace ?

2009-02-16 Thread bearophileHUGS
OdarR: > how would you do a clever find and replace, where the value replacing > the tag is changing on each occurence ? > "...TAGTAGTAG..TAG." > is replaced by this : > "...REPL01REPL02REPL03..REPL04..." You may

Re: Found a very nice, small, cross-platform GUI toolkit for Python.

2009-02-16 Thread Dotan Cohen
> FWIW (and servers set aside, of course), I can hardly remember of any of > linux box I worked one not having both GTK and KDE installed. I don't think that those netbooks come with Qt. And for a Windows installer, where one may want to package the toolkit with the program, a small toolkit may be

flexible find and replace ?

2009-02-16 Thread OdarR
Hi guys, how would you do a clever find and replace, where the value replacing the tag is changing on each occurence ? "...TAGTAGTAG..TAG." is replaced by this : "...REPL01REPL02REPL03..REPL04..." A better and

Re: illegal list name

2009-02-16 Thread Bruno Desthuilliers
Sandra Quiles a écrit : Hello. I have followed the instructions of a post on Installing mailman on OS X 10.4, and got to step 7 and hit this error. (snip) So. illegal name error. it list listname as 'mailman@' that's in response to the 'bin/newlist mailman' command Sorry, this has nothing

Re: Found a very nice, small, cross-platform GUI toolkit for Python.

2009-02-16 Thread Bruno Desthuilliers
laplacia...@gmail.com a écrit : On Feb 16, 1:52 pm, Dotan Cohen wrote: Don't forget that many people will already have Qt already installed, such as KDE users, or those who use Skype, Google Earth, or Opera. Though KDE's Qt will likely be accessibily installed in a convinient place, though, I'm

Speedup Bitmap Parser

2009-02-16 Thread Jayson Santos
Hello people, I'm writing a Bitmap parser for study purposes, however when I parse a bitmap file and when I paint that file in a window, the script take to much time. How can I optimize my script loops to be faster ? Here is the script http://pastebin.com/m652b8d65 Best Regards Jayson Reis -- ht

Re: Easier to wrap C or C++ libraries?

2009-02-16 Thread Hrvoje Niksic
Nick Craig-Wood writes: > Christian Heimes wrote: >> Hrvoje Niksic schrieb: >> > "Diez B. Roggisch" writes: >> > >> >> The answer is easy: if you use C, you can use ctypes to create a >> >> wrapper - with pure python, no compilation, no platform issues. >> > >> > The last part is not true.

Re: replace ftp by local copy

2009-02-16 Thread Steve Holden
loial wrote: > I have been given an old python application that calls ftplib in many > places to copy files to a remote server. > > I have been given the task of cloneing this code so that ftp is not > used, but files are just copied locally in a scenerio where ftp is not > available. The code is

Re: Pythonic way to determine if one char of many in a string

2009-02-16 Thread Stefaan Himpe
An entirely different approach would be to use a regular expression: import re if re.search("[abc]", "nothing expekted"): print "a, b or c occurs in the string 'nothing expekted'" if re.search("[abc]", "something expected"): print "a, b or c occurs in the string 'something expected'" Best

Re: Found a very nice, small, cross-platform GUI toolkit for Python.

2009-02-16 Thread laplacian42
On Feb 16, 1:52 pm, Dotan Cohen wrote: > > Don't forget that many people will already have Qt already installed, > such as KDE users, or those who use Skype, Google Earth, or Opera. > Though KDE's Qt will likely be accessibily installed in a convinient > place, though, I'm not so sure about those

Re: logging and daemons

2009-02-16 Thread Fernando M. Maresca
On Mon, Feb 16, 2009 at 10:11:51AM -0800, Scott David Daniels wrote: > Fernando M. Maresca wrote: > On Mon, Feb 16, 2009 at 05:07:45AM -0800, Garrett Cooper wrote: >>> You can actually set sys.std[err|out] to your ?file? descriptor of >>> choice in python >> Yes, but I'm trying to use *TimedR

Re: wxPython and Croatian characters

2009-02-16 Thread Diez B. Roggisch
vedrandeko...@gmail.com schrieb: Hello, I have problem with configuring my wxPython script to work with Croatian characters like: đ,š,ž,č,ć. Here is my simple script without wxPython (this script works): # -*- coding: utf-8 -*- s = "hello normal string đšžćč" print s ..here

To 3.0.2 or not to 3.0.2?

2009-02-16 Thread Lennart Regebro
I discovered some remaining cmp() in 3.0.1, 38 minutes after Benjamin fixed them. :) Unfortunately, that means porting setuptools to 3.0.1 will be a bit difficult. So my question is: Will there be a 3.0.2 with those fixes, or should I add workaround code for 3.0.1? -- Lennart Regebro: Pythonista,

Re: pythojn/xpath question...

2009-02-16 Thread Diez B. Roggisch
bruce schrieb: hi... using libxml2dom as the xpath lib i've got a situation where i can have: foo=a.xpath( /html/body/table[2]/tr[45]/td) and i can get 11 as the number of returned td elements for the 45th row... this is as it should be. however, if i do: foo=a.xpath( /html/body/table[2]/t

wxPython and Croatian characters

2009-02-16 Thread vedrandekovic
Hello, I have problem with configuring my wxPython script to work with Croatian characters like: đ,š,ž,č,ć. Here is my simple script without wxPython (this script works): # -*- coding: utf-8 -*- s = "hello normal string đšžćč" print s ..here is my snippet with wxPython: t

Re: Found a very nice, small, cross-platform GUI toolkit for Python.

2009-02-16 Thread Dotan Cohen
>> For applications installing the full wxWidgets or Qt toolkits would be >> less disk space and dependcies than OceanGUI > > What? Qt and wX are *huge* compared to OcempGUI. > Don't forget that many people will already have Qt already installed, such as KDE users, or those who use Skype, Google E

Re: Found a very nice, small, cross-platform GUI toolkit for Python.

2009-02-16 Thread laplacian42
On Feb 16, 2:34 am, Python Nutter wrote: > Had a look and it is still under my radar unfortunately because of > TkInter. OceanGUI Note: spelling is "OcempGUI". Also, since google broke some of the links, here's that main link again: http://ocemp.sourceforge.net/gui.html > has a lot of large dec

Re: Pythonic way to determine if one char of many in a string

2009-02-16 Thread J. Cliff Dyer
On Mon, 2009-02-16 at 00:28 -0500, Nicolas Dandrimont wrote: > * pyt...@bdurham.com [2009-02-16 00:17:37 -0500]: > > > I need to test strings to determine if one of a list of chars is > > in the string. A simple example would be to test strings to > > determine if they have a vowel (aeiouAEIOU)

pythojn/xpath question...

2009-02-16 Thread bruce
hi... using libxml2dom as the xpath lib i've got a situation where i can have: foo=a.xpath( /html/body/table[2]/tr[45]/td) and i can get 11 as the number of returned td elements for the 45th row... this is as it should be. however, if i do: foo=a.xpath( /html/body/table[2]/tr) and then try

Re: logging and daemons

2009-02-16 Thread Scott David Daniels
Fernando M. Maresca wrote: On Mon, Feb 16, 2009 at 05:07:45AM -0800, Garrett Cooper wrote: You can actually set sys.std[err|out] to your ?file? descriptor of choice in python Yes, but I'm trying to use *TimedRotating*FileHandler, which makes the fd of the logfile change in every rotation o

Re: how to distribute python extensions independently of python

2009-02-16 Thread Robert Kern
On 2009-02-12 11:38, Travis wrote: So, Recently I made a fix to the zlib module that I need for use at work. Would you mind contributing this fix back to Python? http://bugs.python.org/ If you don't want to go to the effort of making a patch, at least a description of the problem you enco

Re: Pythonic way to determine if one char of many in a string

2009-02-16 Thread Nicolas Dandrimont
* pyt...@bdurham.com [2009-02-16 00:48:34 -0500]: > Nicolas, > > > I would go for something like: > > > > for char in word: > > if char in 'aeiouAEIUO': > > char_found = True > > break > > else: > > char_found = False > > > > It is clear (imo), and it is seems to be the

Re: how to distribute python extensions independently of python

2009-02-16 Thread M.-A. Lemburg
On 2009-02-12 18:38, Travis wrote: > So, > > Recently I made a fix to the zlib module that I need for use at work. > > I would like other employees to be able to use it without recompiling python. > > I assume I can just rename it and distribute it as a python extension. > > I was wondering how

chi squared (X2) in Python

2009-02-16 Thread ts8807385
I was wondering if anyone has done this in Python. I wrote two functions that do it (I think... see below), but I do not understand how to interpret the results. I'm doing an experiment to implement ent in Python. ent tests the randomness of files and chi squared is probably the best test for this

Re: how can this iterator be optimized?

2009-02-16 Thread Basilisk96
On Feb 14, 10:19 am, Paul McGuire wrote: > If func is expensive, you could try memoizing it.  Then subsequent > "calls" just do arg lookups.  Michele Simianato has posted a good > memoizing decorator on the Python wiki. > > -- Paul That's the trick! I almost forgot about that one. Thanks! -Basili

Re: Will multithreading make python less popular?

2009-02-16 Thread Scott David Daniels
andrew cooke wrote: Thanks a lot for writing this, I'll be pointing to it from time to time. Were I writing such a thing I'd focus too much on the how (issues I know that non-GIL true concurrency faces), and not enough on the high level view. Bravo. --Scott David Daniels scott.dani...@acm.org

Re: logging and daemons

2009-02-16 Thread Vinay Sajip
On Feb 16, 1:15 pm, "Fernando M. Maresca" wrote: > Yes, but I'm trying to use *TimedRotating*FileHandler, which makes the > fd of the logfile change in every rotation of the logfile. So the direct > approach of std[out|err] redirection to the logfile fd obtained from > the logger instance is unusa

Re: logging and daemons

2009-02-16 Thread Diez B. Roggisch
Fernando M. Maresca schrieb: Hello. I'm in the process of replacing a custom logger class in one of my apps that has several daemons. In the last step of daemonizing a program, after closing fds, stderr and stdout are redirected to the logfile of the program. Now, I'm trying to use TimedRotatin

Re: Turning a signature-changing decorator into a signature-preserving one

2009-02-16 Thread Gustavo Narea
On Feb 16, 5:18 pm, Michele Simionato wrote: > On Feb 16, 4:59 pm, Gustavo Narea wrote: > > > > > I've not seen anything special in Pylons or TurboGears 2 decorators, > > except that they are all functions that use the decorator package -- > > while my decorator is a class that doesn't use the de

Re: Threads in PyGTK: keep typing while ping-ing

2009-02-16 Thread bieffe62
On 16 Feb, 14:47, Mamahita Sela wrote: > Dear All, > > I have read several howtos for threading in PyGTK. I have tried some but with > no luck. > > What i want is: i can keep typing in gtk.TextView while periodically doing > ping some hosts. > > I think, the thread part is working since i can pi

Re: Windows vista

2009-02-16 Thread Dick
On Feb 16, 1:46 am, loveshadow...@yahoo.com wrote: > Hi. My name is toru. > I start learning python couple weeks ago. > > I install the compiler from python.org. > but I cannot use the IDLE program. > (command line works fine so far) > the error screen says that the my personal fire wall is blockin

Re: [Python-Dev] RELEASED Python 3.0.1

2009-02-16 Thread Benjamin Peterson
On Sun, Feb 15, 2009 at 9:15 PM, Ned Deily wrote: > > It would be great if someone could add OS X links for the 3.0.1 and > 2.6.1 to the main download page, too: > I've now added them to the main download page. -- Regards, Benjamin -- http://mail.python.or

RE: Changing the Image on a button

2009-02-16 Thread John Posner
>> from Tkinter import * >> >> def do(): >> btn.configure(image = None) >> >> root = Tk() >> img1 = PhotoImage(file="bacon.gif") >> >> btn = Button(image = img1, command = do, text = "hello" ) >> btn.img = img1 >> btn.pack() >> root.mainloop() >> Try this change: from: btn.

Re: Will multithreading make python less popular?

2009-02-16 Thread seb . binet
hi there, [snip] > Google uses Processes for the Tabs in Chrome, because that way they get > around many Memory Management Problems they would have with Threads or with > a singlethreaded reactor. Using Processes is not per se a bad Idea. You pay > a bit with Memory and CPU but in many situations

Re: Turning a signature-changing decorator into a signature-preserving one

2009-02-16 Thread Michele Simionato
On Feb 16, 4:59 pm, Gustavo Narea wrote: > I've not seen anything special in Pylons or TurboGears 2 decorators, > except that they are all functions that use the decorator package -- > while my decorator is a class that doesn't use the decorator package > yet. > > My attempt to turn that decorator

Re: Python interface to ODF documents?

2009-02-16 Thread Dotan Cohen
> Since python is one of OpenOffice.org's Macro language, depending on your > need, you might be able to use that as well. > That's not a bad idea. Thanks! -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-

Re: Turning a signature-changing decorator into a signature-preserving one

2009-02-16 Thread Gustavo Narea
On Feb 16, 4:59 pm, Gustavo Narea wrote: > On Feb 16, 4:40 pm, Michele Simionato > wrote: > > > > > > It was broken from the beginning on Pylons. > > > > I'm a TurboGears 2 core developer, and TurboGears is powered by Pylons > > > as of version 2. The decorator has always worked in TurboGears bec

Re: What is a phyton?

2009-02-16 Thread Python
On 16 feb 2009, at 14:45, www.livtotravel.blogspot.com wrote: is phyton a programming language? what can a python do? how is it different from others? -- If i were to replace 'python' with 'french' would you be willing to write the answer in one email? it's gonna be a loong email... if yo

Re: Turning a signature-changing decorator into a signature-preserving one

2009-02-16 Thread Gustavo Narea
On Feb 16, 4:40 pm, Michele Simionato wrote: > > It was broken from the beginning on Pylons. > > > I'm a TurboGears 2 core developer, and TurboGears is powered by Pylons > > as of version 2. The decorator has always worked in TurboGears because > > of the way TG finds the action arguments, but now

Re: Will multithreading make python less popular?

2009-02-16 Thread Christof Donat
Hi, > But there is > something interesting, something like multi processing. But is it a > real alternative for multi threading. As i searched it is not, it > requires heavy hardware requirements (lots of memory, lots of cpu > power). Not necessarily. For the memory, modern operating Systems can

Re: RedHat 4

2009-02-16 Thread J. Cliff Dyer
It *works* in RHEL 4, but it doesn't come as a package. RHEL4 ships with Python 2.3, and RHEL 5 only ships with Python 2.4, even though 2.5 had been out for god knows how long when it came out. Though I haven't tested it, I wouldn't recommend replacing the system's python binary with 2.5 if you d

Re: Turning a signature-changing decorator into a signature-preserving one

2009-02-16 Thread Michele Simionato
On Feb 16, 4:29 pm, Gustavo Narea wrote: > On Feb 16, 4:18 pm, Michele Simionato > wrote: > > > Yes, I am saying don't mess with the internal mechanism of Pylons and > > leave it as > > it was. Or was it broken from the beginning? The only reason I see for > > you > > to touch those things is if

Re: Python interface to ODF documents?

2009-02-16 Thread Lie Ryan
On Sun, 15 Feb 2009 22:03:25 +0200, Dotan Cohen wrote: > Is there a Python interface to ODF documents? I'm thinking of something > that will import, for example, an ADS spreadsheet into a > multidimensional array (including formulas and formatting) and let me > manipulate it, then save it back. >

RedHat 4

2009-02-16 Thread Germán Gutiérrez
Hi, I need to confirm and certificate python 2.5 works in a RedHat Enterprise 4 and I don't know where I find that information. Please, if anybody knows some URL in RedHat or Python with this information email me. Thanks Germán Gutiérrez Gayoso Temuco -- http://mail.python.org/mailma

Re: Turning a signature-changing decorator into a signature-preserving one

2009-02-16 Thread Gustavo Narea
On Feb 16, 4:18 pm, Michele Simionato wrote: > Yes, I am saying don't mess with the internal mechanism of Pylons and > leave it as > it was. Or was it broken from the beginning? The only reason I see for > you > to touch those things is if you are a Pylons core developer. It was broken from the b

Re: Will multithreading make python less popular?

2009-02-16 Thread Hendrik van Rooyen
"andrew cooke" wrote: >The GIL is an implementation detail. I suspect that it could be largely >removed if there was sufficient need. But that still wouldn't make Python >a good language for programming on multiple cores. That's not as big a >deal as you think, because we currently DON'T KNOW

Re: Turning a signature-changing decorator into a signature-preserving one

2009-02-16 Thread Michele Simionato
On Feb 16, 4:07 pm, Gustavo Narea wrote: > But the problem is that it is broken. > > That decorator is for controller actions in Pylons-powered web > applications (which are instance methods). Pylons inspects the > action's signature to find what parameters it's going to pass to its > instance met

Re: Turning a signature-changing decorator into a signature-preserving one

2009-02-16 Thread Gustavo Narea
On Feb 16, 3:56 pm, Michele Simionato wrote: > On Feb 16, 3:50 pm, Gustavo Narea wrote: > > > On Feb 14, 3:27 pm, Michele Simionato > > wrote: > > > > I lack the context to see how this could be fixed in your case, but > > > this a not a show stopper, you can just keep the original decorator > >

Re: Turning a signature-changing decorator into a signature-preserving one

2009-02-16 Thread Michele Simionato
On Feb 16, 3:50 pm, Gustavo Narea wrote: > On Feb 14, 3:27 pm, Michele Simionato > wrote: > > > I lack the context to see how this could be fixed in your case, but > > this a not a show stopper, you can just keep the original decorator > > and forget about making itsignature preserving. > > I'm s

  1   2   >