bulk_copy

2009-05-08 Thread Lawrence D'Oliveiro
Every now and then I've had the need to copy a bunch of records in a MySQL table--perhaps take a copy of some production data into a test database to track down a bug, that kind of thing. So I wrote a utility to do it. -- http://mail.python.org/mail

Re: mod_python and xml.dom.minidom

2009-05-08 Thread Stefan Behnel
Daniel Fetchinson wrote: > On 5/8/09, dpapathanasiou wrote: >> I wrote a python script called xml_utils.py which parses xml using >> minidom. > > My only advice is, don't use mod_python. The project is dead, you > should use mod_wsgi instead: http://code.google.com/p/modwsgi/ Now that we're at it

Re: slice iterator?

2009-05-08 Thread Paul McGuire
On May 8, 11:14 pm, Ned Deily wrote: > In article <7xprejoswg@ruckus.brouhaha.com>, >  Paul Rubin wrote: > > > > > > > Ross writes: > > > I have a really long list that I would like segmented into smaller > > > lists. Let's say I had a list a = [1,2,3,4,5,6,7,8,

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread Carl Banks
On May 8, 7:19 pm, namekuseijin wrote: > On May 8, 10:13 pm, Carl Banks wrote: > > > On May 8, 5:47 pm, namekuseijin wrote: > > > > My point is that when all you do is call functions, syntax is > > > irrelevant.  You call functions pretty much in the same way regardless > > > of language:  funct

Re: SQL and CSV

2009-05-08 Thread Lawrence D'Oliveiro
In message , andrew cooke wrote: > Lawrence D'Oliveiro wrote: >> In message , Peter Otten wrote: >> >>> While it may not matter here using placeholders instead of manually >>> escaping user-provided values is a good habit to get into. >> >> Until you hit things it can't deal with. > > Can you ex

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread Lawrence D'Oliveiro
In message <692b7ae8-0c5b-498a- a012-51bda980f...@s28g2000vbp.googlegroups.com>, namekuseijin wrote: > On May 8, 6:48 pm, Lawrence D'Oliveiro central.gen.new_zealand> wrote: >> In message , namekuseijin wrote: >> >> > Carl Banks escreveu: >> >> >> 2. However, functional programming is cryptic at

Re: slice iterator?

2009-05-08 Thread Scott David Daniels
Ross wrote: I have a really long list that I would like segmented into smaller lists. Let's say I had a list a = [1,2,3,4,5,6,7,8,9,10,11,12] and I wanted to split it into groups of 2 or groups of 3 or 4, etc. Is there a way to do this without explicitly defining new lists? If the above problem w

Re: ISO exemplary Python scripts

2009-05-08 Thread Tim Roberts
kj wrote: > >I'm learning python, for the umpteenth time. This time I decided >to start out by writing Python scripts for everyday tasks. Most >of these scripts are meant to be used only once or twice, but a >few of them have become useful enough that I'd like to make them >a little bit more sol

Re: mod_python and xml.dom.minidom

2009-05-08 Thread Daniel Fetchinson
On 5/8/09, dpapathanasiou wrote: > I wrote a python script called xml_utils.py which parses xml using > minidom. > > It works when it's run on its own, but when I try to import it and run > it inside a mod_python handler, I get this error: > > File "../common/xml_utils.py", line 80, in parse_ite

Re: slice iterator?

2009-05-08 Thread Ned Deily
In article <7xprejoswg@ruckus.brouhaha.com>, Paul Rubin wrote: > Ross writes: > > I have a really long list that I would like segmented into smaller > > lists. Let's say I had a list a = [1,2,3,4,5,6,7,8,9,10,11,12] and I > > wanted to split it into groups of 2

Re: heapq.merge with key=

2009-05-08 Thread Kevin D . Smith
On 2009-05-07 23:48:43 -0500, Chris Rebert said: On Thu, May 7, 2009 at 2:23 PM, Kevin D. Smith wrote: I need the behavior of heapq.merge to merge a bunch of results from a database.  I was doing this with sorted(itertools.chain(...), key= ...), but I would prefer to do this with generators

Re: slice iterator?

2009-05-08 Thread John O'Hagan
On Sat, 9 May 2009, John O'Hagan wrote: > On Sat, 9 May 2009, Ross wrote: > > lists. Let's say I had a list a = [1,2,3,4,5,6,7,8,9,10,11,12] and I > > wanted to split it into groups of 2 or groups of 3 or 4, etc. Is there > > a way to do this without explicitly defining new lists? If the above > >

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread Lie Ryan
Casey Hawthorne wrote: I'm intrigued that Python has some functional constructions in the language. Would it be possible to more clearly separate the pure code (without side effects) from the impure code (that deals with state changes, I/O, etc.), so that the pure code could be compiled and have

Re: slice iterator?

2009-05-08 Thread John O'Hagan
On Sat, 9 May 2009, Ross wrote: > lists. Let's say I had a list a = [1,2,3,4,5,6,7,8,9,10,11,12] and I > wanted to split it into groups of 2 or groups of 3 or 4, etc. Is there > a way to do this without explicitly defining new lists? If the above > problem were to be split into groups of 3, I've tr

Re: import overwrites __name__

2009-05-08 Thread Dave Angel
Marco wrote: Marco wrote: Hi, There happened something that I do not understand. Actually I don't even know how it can be possible. I import a module and then the name space of the importing module seems do be overwritten. my_name = __name__ print my_name print len(dir()) from x import y

Re: slice iterator?

2009-05-08 Thread Paul Rubin
Ross writes: > I have a really long list that I would like segmented into smaller > lists. Let's say I had a list a = [1,2,3,4,5,6,7,8,9,10,11,12] and I > wanted to split it into groups of 2 or groups of 3 or 4, etc. Is there > a way to do this without explicitly defining new lists? That questio

slice iterator?

2009-05-08 Thread Ross
I have a really long list that I would like segmented into smaller lists. Let's say I had a list a = [1,2,3,4,5,6,7,8,9,10,11,12] and I wanted to split it into groups of 2 or groups of 3 or 4, etc. Is there a way to do this without explicitly defining new lists? If the above problem were to be spli

Re: Python 2.6, File read() problems in Windows Xp

2009-05-08 Thread Li Wang
> (my smtp mail server has been down for a few hours, so you have some other > responses.) > > yes, as far as I can tell from the docs, the 'b' flag doesn't matter in > Unix/Linux. Note that I haven't actually been on a Unix machine since > starting with Python, but it matches what else I know. A

Re: Simple programme - Just want to know whether this is correct way of coding

2009-05-08 Thread namekuseijin
On May 8, 3:37 am, guptha wrote: > The code Works fine ,but I doubt about the performance issue ,My > intention is to send mails concurrently to large number of mail. > 1.For every mail id i send It creates a new SMTP object,in case, if i > send to 1000 or more ids why should I help a spammer...

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread namekuseijin
On May 8, 10:13 pm, Carl Banks wrote: > On May 8, 5:47 pm, namekuseijin wrote: > > > My point is that when all you do is call functions, syntax is > > irrelevant.  You call functions pretty much in the same way regardless > > of language:  functionname, optionalOpenPar, parameters, > > optionalCl

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread Paul Rubin
Carl Banks writes: > I can go on, but you get the idea. Point is: functional programmint > isn't "nothing but calling functions". I would mainly describe functional programming as programming with the pervasive use of higher order functions. For example, loops in functional programming can be i

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread Carl Banks
On May 8, 5:47 pm, namekuseijin wrote: > My point is that when all you do is call functions, syntax is > irrelevant.  You call functions pretty much in the same way regardless > of language:  functionname, optionalOpenPar, parameters, > optionalClosePar. then... > Functional programming is all a

Re: Why there is a parameter named "self" for classmethod function?

2009-05-08 Thread Steven D'Aprano
On Thu, 07 May 2009 04:27:15 -0700, Aaron Brady wrote: >> Can be, but if there's reason enough to keep it with a class, there's >> no reason not to. > > That's a bit of hyperbole; the usual reasons such as code bloat, > namespace bloat, maintainability etc. all weigh against it. It's just > that

Re: Simple programme - Just want to know whether this is correct way of coding

2009-05-08 Thread Steven D'Aprano
On Thu, 07 May 2009 23:37:27 -0700, guptha wrote: > The code Works fine ,but I doubt about the performance issue ,My > intention is to send mails concurrently to large number of mail. 1.For > every mail id i send It creates a new SMTP object,in case, if i send to > 1000 or more ids > a) It o

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread Paul Rubin
Casey Hawthorne writes: > Would it be possible to more clearly separate the pure code (without > side effects) from the impure code (that deals with state changes, > I/O, etc.), so that the pure code could be compiled and have > aggressive functional transformations applied to it for efficiency.

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread namekuseijin
On May 8, 7:22 pm, Carl Banks wrote: > On May 8, 1:56 pm, namekuseijin wrote: > > Carl Banks escreveu: > > > 2. However, functional programming is cryptic at some level no matter > > > how nice you make the syntax. > > > When your program is nothing but function definition and function > > applic

Re: unicode bit me

2009-05-08 Thread Steven D'Aprano
On Fri, 08 May 2009 14:22:32 -0400, Terry Reedy wrote: > Scott David Daniels wrote: > >> It would be a bit easier if people would bother to mention their >> Python version, as we regularly get questions from people running 2.3, >> 2.4, 2.5, 2.6, 2.7a, 3.0, and 3.1b. They run computers with diffe

Re: Self function

2009-05-08 Thread Steven D'Aprano
On Thu, 07 May 2009 08:21:51 -0700, Francis Carr wrote: > In the special case of a self-recursive function, you would like re- > naming "to just work". Out of morbid curiosity, I am compelled to > ask... why do you expect that re-naming anything --- a function, a > class, a module, a variable, an

Re: list comprehension question

2009-05-08 Thread Steven D'Aprano
On Thu, 07 May 2009 13:28:10 -0400, J Kenneth King wrote: > Steven D'Aprano writes: > >> On Wed, 06 May 2009 09:48:51 -0400, J Kenneth King wrote: >> >>> Emile van Sebille writes: >>> On 5/5/2009 9:15 AM J Kenneth King said... > List comprehensions can make a reader of your code

ISO exemplary Python scripts

2009-05-08 Thread kj
I'm learning python, for the umpteenth time. This time I decided to start out by writing Python scripts for everyday tasks. Most of these scripts are meant to be used only once or twice, but a few of them have become useful enough that I'd like to make them a little bit more solid... I'd like

Re: Complete frustration

2009-05-08 Thread Scott David Daniels
hellcats wrote: On May 8, 5:36 pm, Emile van Sebille wrote: On 5/8/2009 3:08 PM hellcats said... On May 8, 4:18 pm, Emile van Sebille wrote: This is a windows question -- you'll need to reassign the default association of PYW files. Look in explorer|tools|folder options. Emile I know th

Re: Threads and daemon processes

2009-05-08 Thread Gabriel Genellina
En Fri, 08 May 2009 18:06:02 -0300, Jeffrey Barish escribió: I have a program that uses threading.Timer to execute a function after a delay. It works fine when I run the program normally, but when I run the program as a daemon process, I can't find any evidence that the function ever runs.

Re: Newcomer to Python tutorial question

2009-05-08 Thread Steven D'Aprano
On Thu, 07 May 2009 11:40:57 -0700, Chris Rebert wrote: >> why is the printed result of >> > basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'} > print(basket) >> {'orange', 'banana', 'pear', 'apple'} >> >> in the sequence given? > > Because it's *not a sequence* at all, it

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread namekuseijin
On May 8, 6:48 pm, Lawrence D'Oliveiro wrote: > In message , namekuseijin wrote: > > > Carl Banks escreveu: > > >> 2. However, functional programming is cryptic at some level no matter > >> how nice you make the syntax. > > > When your program is nothing but function definition and function > > ap

Re: Complete frustration

2009-05-08 Thread Emile van Sebille
On 5/8/2009 3:59 PM Casey Hawthorne said... On Fri, 08 May 2009 14:18:44 -0700, Emile van Sebille This is a windows question -- you'll need to reassign the default association of PYW files. Look in explorer|tools|folder options. Emile I believe this option is in the Python init file! A

mod_python and xml.dom.minidom

2009-05-08 Thread dpapathanasiou
I wrote a python script called xml_utils.py which parses xml using minidom. It works when it's run on its own, but when I try to import it and run it inside a mod_python handler, I get this error: File "../common/xml_utils.py", line 80, in parse_item_attribute File "/usr/lib/python2.5/xml/dom

Re: Complete frustration

2009-05-08 Thread hellcats
On May 8, 5:36 pm, Emile van Sebille wrote: > On 5/8/2009 3:08 PM hellcats said... > > > On May 8, 4:18 pm, Emile van Sebille wrote: > > >> This is a windows question -- you'll need to reassign the default > >> association of PYW files.  Look in explorer|tools|folder options. > > >> Emile > > >

Re: import overwrites __name__

2009-05-08 Thread Glenn Hutchings
On Fri, 08 May 2009 19:14:52 +0200, Marco wrote: > I import a module and then the name space of the importing module seems do > be overwritten. > > my_name = __name__ > print my_name > print len(dir()) > from x import y as z > print __name__ > print len(dir()) > print my_name > > -> > __main__

Re: Complete frustration

2009-05-08 Thread Casey Hawthorne
On Fri, 08 May 2009 14:18:44 -0700, Emile van Sebille wrote: >On 5/8/2009 1:45 PM hellcats said... >> I have Python2.5 installed on Windows XP. Whenever I double click on a >> something.pyw file, IDLE launches and opens something.pyw in the >> editor. I would prefer to actually *RUN* the program,

Re: Complete frustration

2009-05-08 Thread Scott David Daniels
hellcats wrote: On May 8, 4:18 pm, Emile van Sebille wrote: On 5/8/2009 1:45 PM hellcats said...> I have Python2.5 installed on Windows XP. Whenever I double click on a something.pyw file, IDLE launches and opens something.pyw in the editor. I would prefer to actually *RUN* the program, not e

Re: Complete frustration

2009-05-08 Thread Emile van Sebille
On 5/8/2009 3:08 PM hellcats said... On May 8, 4:18 pm, Emile van Sebille wrote: This is a windows question -- you'll need to reassign the default association of PYW files. Look in explorer|tools|folder options. Emile I know that. I've tried reassigning it from pythonw.exe to python.exe,

Re: Is it better to use threads or fork in the following case

2009-05-08 Thread JanC
Gabriel Genellina wrote: > In addition, the zip file format stores the directory at the end of the > file. So you can't process it until it's completely downloaded. Well, you *can* download the directory part first (if the HTTP server supports it), and if you only need some files, you could t

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread Carl Banks
On May 8, 1:56 pm, namekuseijin wrote: > Carl Banks escreveu: > > > 2. However, functional programming is cryptic at some level no matter > > how nice you make the syntax. > > When your program is nothing but function definition and function > application, syntax is meaningless. For mere function

Re: Complete frustration

2009-05-08 Thread hellcats
On May 8, 4:18 pm, Emile van Sebille wrote: > On 5/8/2009 1:45 PM hellcats said...> I have Python2.5 installed on Windows > XP. Whenever I double click on a > > something.pyw file, IDLE launches and opens something.pyw in the > > editor. I would prefer to actually *RUN* the program, not edit it.

Re: import overwrites __name__

2009-05-08 Thread Stephen Hansen
> > > Still I appreciate if someone could explain me why. > We can't without seeing the code. There shouldn't be any difference, so if there is then its because your code is doing something to cause it-- break it down to a runnable example and we may be able to tell you why, giving us real code an

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread Lawrence D'Oliveiro
In message , namekuseijin wrote: > Carl Banks escreveu: > >> 2. However, functional programming is cryptic at some level no matter >> how nice you make the syntax. > > When your program is nothing but function definition and function > application, syntax is meaningless. On the contrary, syntax

Re: import overwrites __name__

2009-05-08 Thread Marco
Stephen Hansen wrote: >> >> So what leads to the behavior that the .pyc is not created? >> > > PYC's are only generated on import, they're never made for the main > script. > > I personally like to keep my 'main script' very small. Largely just > something which imports other modules and sends

Re: import overwrites __name__

2009-05-08 Thread Stephen Hansen
> > So what leads to the behavior that the .pyc is not created? > PYC's are only generated on import, they're never made for the main script. I personally like to keep my 'main script' very small. Largely just something which imports other modules and sends them along on their business. --S --

Re: unicode bit me

2009-05-08 Thread Piet van Oostrum
> "J. Cliff Dyer" (JCD) a écrit: >JCD> On Fri, 2009-05-08 at 07:53 -0700, anuraguni...@yahoo.com wrote: >>> #how can I print a list of object which may return unicode >>> representation? >>> # -*- coding: utf-8 -*- >>> >>> class A(object): >>> >>> def __unicode__(self): >>> return u"©au" >>

Re: Complete frustration

2009-05-08 Thread Emile van Sebille
On 5/8/2009 1:45 PM hellcats said... I have Python2.5 installed on Windows XP. Whenever I double click on a something.pyw file, IDLE launches and opens something.pyw in the editor. I would prefer to actually *RUN* the program, not edit it. If I want to edit it then I'll choose the "Edit with IDLE

Re: import overwrites __name__

2009-05-08 Thread Marco
Marco wrote: > Hi, > > There happened something that I do not understand. Actually I don't even > know how it can be possible. > > I import a module and then the name space of the importing module seems do > be overwritten. > > my_name = __name__ > print my_name > print len(dir()) > from x impo

Re: php to python code converter

2009-05-08 Thread MRAB
J. Cliff Dyer wrote: On Fri, 2009-05-08 at 17:19 +0200, Pascal Chambon wrote: PS : Am I the only one having most of answers rejected by the antispam system of python-list ? That's humiliating :p I've had several messages not make it through. :( Same here ("Message has a suspicious header

Threads and daemon processes

2009-05-08 Thread Jeffrey Barish
I have a program that uses threading.Timer to execute a function after a delay. It works fine when I run the program normally, but when I run the program as a daemon process, I can't find any evidence that the function ever runs. Is it the case that daemon processes are not allowed to create a th

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread namekuseijin
Carl Banks escreveu: 2. However, functional programming is cryptic at some level no matter how nice you make the syntax. When your program is nothing but function definition and function application, syntax is meaningless. It's kinda like scripting, say, Microsoft Word in either Visual Basic

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread namekuseijin
prueba...@latinmail.com escreveu: Don't forget that the Python interpreter is simple. It makes maintenance easier and allows embedding it into other programs. Good optimizing compilers for functional languages are not simple. Good optimizing compilers are not simple, period. The python interpr

Complete frustration

2009-05-08 Thread hellcats
I have Python2.5 installed on Windows XP. Whenever I double click on a something.pyw file, IDLE launches and opens something.pyw in the editor. I would prefer to actually *RUN* the program, not edit it. If I want to edit it then I'll choose the "Edit with IDLE" context menu. So I then have to press

Re: import overwrites __name__

2009-05-08 Thread Marco
Terry Reedy wrote: > Marco wrote: >> Hi, >> >> There happened something that I do not understand. Actually I don't even >> know how it can be possible. >> >> I import a module and then the name space of the importing module seems >> do be overwritten. >> >> my_name = __name__ >> print my_name >

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread Carl Banks
On May 8, 12:04 pm, Casey Hawthorne wrote: > I'm intrigued that Python has some functional constructions in the > language. > > Would it be possible to more clearly separate the pure code (without > side effects) from the impure code (that deals with state changes, > I/O, etc.), so that the pure c

Re: I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread pruebauno
On May 8, 3:04 pm, Casey Hawthorne wrote: > I'm intrigued that Python has some functional constructions in the > language. > > Would it be possible to more clearly separate the pure code (without > side effects) from the impure code (that deals with state changes, > I/O, etc.), so that the pure co

Re: ECG segmentation

2009-05-08 Thread CTO
On May 8, 2:04 pm, Filip Gruszczyński wrote: > Hi! > > I need to create a script, that performs ECG segmentation, but I can > hardly find any useful materials on the web. Did anyone try to do this > and could point me to some good materials/snippets about this? > > -- > Filip Gruszczyński How are

Re: php to python code converter

2009-05-08 Thread J. Cliff Dyer
On Fri, 2009-05-08 at 17:19 +0200, Pascal Chambon wrote: > PS : Am I the only one having most of answers rejected by the > antispam > system of python-list ? That's humiliating :p > I've had several messages not make it through. :( -- http://mail.python.org/mailman/listinfo/python-list

I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread Casey Hawthorne
I'm intrigued that Python has some functional constructions in the language. Would it be possible to more clearly separate the pure code (without side effects) from the impure code (that deals with state changes, I/O, etc.), so that the pure code could be compiled and have aggressive functional tr

Re: unicode bit me

2009-05-08 Thread J. Cliff Dyer
On Fri, 2009-05-08 at 07:53 -0700, anuraguni...@yahoo.com wrote: > #how can I print a list of object which may return unicode > representation? > # -*- coding: utf-8 -*- > > class A(object): > > def __unicode__(self): > return u"©au" > > __str__ = __repr__ = __unicode__ > Your

Re: import overwrites __name__

2009-05-08 Thread Terry Reedy
Marco wrote: Hi, There happened something that I do not understand. Actually I don't even know how it can be possible. I import a module and then the name space of the importing module seems do be overwritten. my_name = __name__ print my_name print len(dir()) from x import y as z print __n

Re: unicode bit me

2009-05-08 Thread Terry Reedy
Scott David Daniels wrote: It would be a bit easier if people would bother to mention their Python version, as we regularly get questions from people running 2.3, 2.4, 2.5, 2.6, 2.7a, 3.0, and 3.1b. They run computers with differing operating systems and versions such as: Windows 2000, OS/X Leo

Re: How to debug this import problem?

2009-05-08 Thread Scott David Daniels
Diez B. Roggisch wrote: Iwan Vosloo wrote: We have a rather complicated program which does a bit of os.chdir and sys.path manipulations. In between all of this, it imports the decimal module several times However, it imports a new instance of decimal sometimes. (Which is a problem, since a

Re: FLV download script works, but I want to enhance it

2009-05-08 Thread The Music Guy
On Thu, May 7, 2009 at 9:29 AM, Aahz wrote: > > Here's my download script to get you started figuring this out, it does > the wget in the background so that several downloads can run in parallel > from a single terminal window: > > #!/bin/bash > > echo "Downloading $1" > wget "$1" > /dev/null 2>&1

Re: php to python code converter

2009-05-08 Thread Dotan Cohen
> I'm almost 100% sure it won't. The code is machine-generated, thus not easy > to the human eye, not idiomatic so you don't learn how to write good python > through it. You learn how to jump through hoops to code the same way in > python that you do in PHP. > I meant for single functions, not for

ECG segmentation

2009-05-08 Thread Filip Gruszczyński
Hi! I need to create a script, that performs ECG segmentation, but I can hardly find any useful materials on the web. Did anyone try to do this and could point me to some good materials/snippets about this? -- Filip Gruszczyński -- http://mail.python.org/mailman/listinfo/python-list

Re: php to python code converter

2009-05-08 Thread Diez B. Roggisch
Dotan Cohen wrote: >> I'm not a big fan of PHP but I don't understand the desireability of >> such a tool.  If you have a good PHP app just run it.  The point of >> Python in my mind is that it is a cleaner syntax and promotes better >> code.  Anything that converts PHP to Python is going to leave

Re: How to debug this import problem?

2009-05-08 Thread Diez B. Roggisch
Iwan Vosloo wrote: > Hi there, > > We have a rather complicated program which does a bit of os.chdir and > sys.path manipulations. In between all of this, it imports the decimal > module several times. > > However, it imports a new instance of decimal sometimes. (Which is a > problem, since a

Re: subprocess.Popen howto?

2009-05-08 Thread norseman
Carl Banks wrote: On May 7, 2:58 pm, norseman wrote: If you don't like a lot of typing that obscures the process, take a look at os.Popen2 Pg.39 or so in Lib.pdf for 2.5.2 In this case - the popen3 is probably your best bet. I took a test run on "subprocess" a few months ago. My review: exces

Re: Self function

2009-05-08 Thread Gabriel Genellina
En Wed, 06 May 2009 23:32:23 -0300, Luis Alberto Zarrabeitia Gomez escribió: Quoting Steven D'Aprano : But regardless, everyone is missing the most important point: why are you copying and pasting code in the first place? That is surely very close to the top of the list of Worst Ever An

Re: php to python code converter

2009-05-08 Thread D'Arcy J.M. Cain
On Fri, 8 May 2009 19:33:10 +0300 Dotan Cohen wrote: > It would be a great learning tool. I am pretty decent with PHP but > just getting started in Python. This might help such users flatten out > the learning curve. If there were such a tool available I would sugegst it come with huge warnings s

import overwrites __name__

2009-05-08 Thread Marco
Hi, There happened something that I do not understand. Actually I don't even know how it can be possible. I import a module and then the name space of the importing module seems do be overwritten. my_name = __name__ print my_name print len(dir()) from x import y as z print __name__ print len(d

Re: How do I test the integrity of a Python installation in Debian and Ubuntu

2009-05-08 Thread Aahz
In article , Geoff Gardiner wrote: > >How do I assure myself of the integrity of a Python installation >acquired using apt-get install on Debian and Ubuntu? How important is the apt-get requirement? Building Python yourself in this situation sounds like it would be simpler/safer. -- Aahz (a...

How to debug this import problem?

2009-05-08 Thread Iwan Vosloo
Hi there, We have a rather complicated program which does a bit of os.chdir and sys.path manipulations. In between all of this, it imports the decimal module several times. However, it imports a new instance of decimal sometimes. (Which is a problem, since a decimal.Decimal (imported at point A

building 32-bit PyQT4 and matplotlib on X86_64

2009-05-08 Thread enricong
I'm having some issues attempting to build PyQT4 and matplotlib. I'm on a 64-bit machine and am trying to build a 32-bit version. I have already installed seperate 32-bit libs and a 32-bit version of python however I continue to run into two basic problems With PyQT4, I dont know how to tell it

Re: Decorating methods - where do my arguments go?

2009-05-08 Thread Peter Otten
Mikael Olofsson wrote: > Hi all! > > I have long tried to avoid decorators, but now I find myself in a > situation where I think they can help. I seem to be able to decorate > functions, but I fail miserably when trying to decorate methods. The > information I have been able to find on-line focus

Re: Path difficulties with Python 2.5 running on Cygwin

2009-05-08 Thread Scott David Daniels
walterbyrd wrote: On May 8, 10:01 am, walterbyrd wrote: On May 8, 9:36 am, Jerry Hill wrote: On Fri, May 8, 2009 at 11:29 AM, walterbyrd wrote: I accidently named a script csv.py, put I deleted that. You probably still have a stale csv.pyc in that directory. Delete that too. Okay, I got

Re: SQL and CSV

2009-05-08 Thread andrew cooke
even if you're not open to injection attacks, you're still less likely to get escaping correct than a puprose written, widely used library. my request for more information was directed to lawrence, who said "until you hit things it can't deal with" which seemed to be some kind of cryptic argument

Re: free chart lib for Python?

2009-05-08 Thread cgoldberg
> You could try matplotlib:http://matplotlib.sourceforge.net. +1 Matplotlib. It's a very nice module with impressive graphing/charting/plotting capabilities. -- http://mail.python.org/mailman/listinfo/python-list

Re: php to python code converter

2009-05-08 Thread Dotan Cohen
> I'm not a big fan of PHP but I don't understand the desireability of > such a tool.  If you have a good PHP app just run it.  The point of > Python in my mind is that it is a cleaner syntax and promotes better > code.  Anything that converts PHP to Python is going to leave you with > some butt-ug

Re: php to python code converter

2009-05-08 Thread Pascal Chambon
D'Arcy J.M. Cain a écrit : On Fri, 08 May 2009 17:19:13 +0200 Pascal Chambon wrote: That's funny, I was precisely thinking about a php to python converter, some weeks ago. Such a tool, allowing for example to convert some CMS like Drupal to python, would be a killer app, when we consider t

Re: php to python code converter

2009-05-08 Thread Pascal Chambon
D'Arcy J.M. Cain a écrit : On Fri, 08 May 2009 17:19:13 +0200 Pascal Chambon wrote: That's funny, I was precisely thinking about a php to python converter, some weeks ago. Such a tool, allowing for example to convert some CMS like Drupal to python, would be a killer app, when we consider th

Re: Compiling snippets of python code

2009-05-08 Thread Basil Brush
Scott David Daniels wrote: > make lists and dictionaries containing functions, and that would be > the normal Python way of handling this, rather than generating source > from snippets. You should take a look at Numpy if the "maths functions" Thank you very much for your response. I hadn't thoug

Re: Path difficulties with Python 2.5 running on Cygwin

2009-05-08 Thread walterbyrd
On May 8, 10:01 am, walterbyrd wrote: > On May 8, 9:36 am, Jerry Hill wrote: > > > On Fri, May 8, 2009 at 11:29 AM, walterbyrd wrote: > > > I accidently named a script csv.py, put I deleted that. > > > You probably still have a stale csv.pyc in that directory.  Delete that too. > Okay, I got it

Re: subprocess.Popen howto?

2009-05-08 Thread norseman
Øystein ; Down below: change >yourPy.py to | yourPy.py I just noticed the typo. Sorry Steve norseman wrote: Øystein Johansen (OJOHANS) wrote: Hi, I have problems understanding the subprocess.Popen object. I have a iterative calculation in a process running and I want to pipe the

Re: free chart lib for Python?

2009-05-08 Thread Glenn Hutchings
On Fri, 08 May 2009 10:27:08 +0800, oyster wrote: > I mean chart, not plot. If you don't know the difference, you can > check www.advsofteng.com, which is a commercial program > > is there such a thing with many kinds of chart, i.e. pie-chart, > line-chart, ..? You could try matplotlib: http

Re: Path difficulties with Python 2.5 running on Cygwin

2009-05-08 Thread walterbyrd
On May 8, 9:36 am, Jerry Hill wrote: > On Fri, May 8, 2009 at 11:29 AM, walterbyrd wrote: > > I accidently named a script csv.py, put I deleted that. > > You probably still have a stale csv.pyc in that directory.  Delete that too. > I don't, I am very certain of that. I have also used find to ma

Re: unicode bit me

2009-05-08 Thread Scott David Daniels
anuraguni...@yahoo.com wrote: #how can I print a list of object which may return unicode representation? # -*- coding: utf-8 -*- class A(object): def __unicode__(self): return u"©au" __str__ = __repr__ = __unicode__ a = A() try: print a # doesn't work? except UnicodeEncod

Re: php to python code converter

2009-05-08 Thread D'Arcy J.M. Cain
On Fri, 08 May 2009 17:19:13 +0200 Pascal Chambon wrote: > That's funny, I was precisely thinking about a php to python converter, > some weeks ago. > Such a tool, allowing for example to convert some CMS like Drupal to > python, would be a killer app, when we consider the amount of php code >

Re: Path difficulties with Python 2.5 running on Cygwin

2009-05-08 Thread Jerry Hill
On Fri, May 8, 2009 at 11:29 AM, walterbyrd wrote: > I accidently named a script csv.py, put I deleted that. You probably still have a stale csv.pyc in that directory. Delete that too. To tell for sure, open the python interpreter and do: import csv print csv.__file__ That will tell you exactl

Decorating methods - where do my arguments go?

2009-05-08 Thread Mikael Olofsson
Hi all! I have long tried to avoid decorators, but now I find myself in a situation where I think they can help. I seem to be able to decorate functions, but I fail miserably when trying to decorate methods. The information I have been able to find on-line focuses on decorating functions, and

Re: Path difficulties with Python 2.5 running on Cygwin

2009-05-08 Thread walterbyrd
On May 8, 9:22 am, walterbyrd wrote: > It workerd fine yesterday, but it won't work today. > > I can still run python, but when I try to import csv, I get an error: > > File "/usr/lib/python2.5/csv.py", line 8 in  . . . > > The module is there. I am guessing that python can not find it. I should

Path difficulties with Python 2.5 running on Cygwin

2009-05-08 Thread walterbyrd
It workerd fine yesterday, but it won't work today. I can still run python, but when I try to import csv, I get an error: File "/usr/lib/python2.5/csv.py", line 8 in . . . The module is there. I am guessing that python can not find it. -- http://mail.python.org/mailman/listinfo/python-list

Re: php to python code converter

2009-05-08 Thread Pascal Chambon
Hello That's funny, I was precisely thinking about a php to python converter, some weeks ago. Such a tool, allowing for example to convert some CMS like Drupal to python, would be a killer app, when we consider the amount of php code available. But of course, there are lots of issues that'd

Re: Newcomer to Python tutorial question

2009-05-08 Thread Peter Pearson
On Fri, 8 May 2009 10:16:55 +0100, Alan Cameron wrote: [snip] > > In particular reference to the tutorial section > http://docs.python.org/3.0/tutorial/datastructures.html#nested-list-comprehensions > > There is a word which is ambiguous, at least to me. > > Perhaps you can explain the use of the

Re: Tutorial or example use for python-graph library

2009-05-08 Thread Scott David Daniels
Paul Moore wrote: I have just discovered the python-graph library. I've been interested in graph algorithms for a long time, so I'd like to give this a try. But there seems to be very little in the way of examples, or tutorial documentation available. There's the API documentation, but that's not

Re: Call a function when a thread exits

2009-05-08 Thread Giampaolo Rodola'
On 8 Mag, 03:33, Carl Banks wrote: > On May 7, 6:12 pm, "Giampaolo Rodola'" wrote: > > > > > > > Hi, > > I'm searching for a smooth way to call a certain function when a > > thread has finished its job. > > I guess I can keep calling isAlive() in a loop and call my function > > when it returns Fa

  1   2   >