[Tutor] getting system temporary directory.

2006-04-25 Thread Keo Sophon
Hi all, Does python has any function to get a system tempdir of an OS? Thanks, Phon ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] A Python idiom that I don't get

2006-04-25 Thread w chun
> > prefix = os.path.commonprefix(filter( bool, lines )) that is an interesting and yes, not very optimal way of saving the set of non-blank lines. the commonprefix() function takes a list of pathnames and returns the longest prefix that all strings have in common, presumably for disk filena

Re: [Tutor] Avoiding the use of files to store intermediate results

2006-04-25 Thread Bob Gailer
Andre Roberge wrote: > On 4/25/06, Hugo González Monteverde <[EMAIL PROTECTED]> wrote: > >> Remember duck typing. An object just needs to look like a file in order >> to be used like one. >> >> Guido's time machine has already forseen your problem. Take a look at >> the StringIO module. It allo

Re: [Tutor] A Python idiom that I don't get

2006-04-25 Thread Kent Johnson
Don Taylor wrote: > I am trying to get some existing CPython 2.4 code working under Jython > (2.1) and I am puzzled by a line in the following function. It seems to > be a Python 2.4 idiom that is opaque to me. > > The line is: > prefix = os.path.commonprefix(filter( bool, lines )) > > an

[Tutor] A Python idiom that I don't get

2006-04-25 Thread Don Taylor
I am trying to get some existing CPython 2.4 code working under Jython (2.1) and I am puzzled by a line in the following function. It seems to be a Python 2.4 idiom that is opaque to me. The line is: prefix = os.path.commonprefix(filter( bool, lines )) and I don't understand what that 'bo

Re: [Tutor] Avoiding the use of files to store intermediate results

2006-04-25 Thread Andre Roberge
On 4/25/06, Hugo González Monteverde <[EMAIL PROTECTED]> wrote: > Remember duck typing. An object just needs to look like a file in order > to be used like one. > > Guido's time machine has already forseen your problem. Take a look at > the StringIO module. It allows you to use a string where you

[Tutor] seq looping

2006-04-25 Thread kevin parks
I have a loop that process each item in a sequence and after each item some updating is done to some variables. However i don't what these variable updated if we are processing the last item in the list. i could put in a conditional and test if the list is now empty after popping items from the

Re: [Tutor] Dictionaries and aggregation

2006-04-25 Thread Paul Churchill
Right think I've got the idea now. Thanks for all contributions on this. Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Karl "Pflästerer" Sent: 25 April 2006 22:28 To: tutor@python.org Subject: Re: [Tutor] Dictionaries and aggregation On 25 Apr

Re: [Tutor] Dictionaries and aggregation

2006-04-25 Thread Karl Pflästerer
On 25 Apr 2006, [EMAIL PROTECTED] wrote: [...] > Here's the list I'm starting with: > for i in rLst: print i, type(i) > > server001 alive 17.1% 2 requests/s 14805416 total > server001 alive 27.2% 7 requests/s 14851125 total > server002 alive 22.9% 6 requ

Re: [Tutor] Dictionaries and aggregation

2006-04-25 Thread paul . churchill
Kent Johnson writes: >> However here's what I'm now trying to do: >> >> 1) Not have to rely on using awk at all. >> >> >> 2) Create a dictionary with server names for keys e.g. server001, >> server002 etc and the aggregate of the request for that server as the value >> part of t

Re: [Tutor] Generating static WEB sites

2006-04-25 Thread Kent Johnson
Peter Jessop wrote: > I am looking at generating static web pages. > What I wish to do is periodically regenerate a WEB site form HTML, text > and MySQL data. > > I have been experimenting with HTMLgen and this seems to be adequate for > what I need. > > However HTMLgen does not seem to have be

Re: [Tutor] Problem installing MySQLdb under windows

2006-04-25 Thread Andy Koch
Kent Johnson wrote: > Peter Jessop wrote: >> I am running Python 2.4.3, MySQL 5.0. >> On trying to install MySQLdb 1.2.1 I ran into the following problem. >> " >> D:\Python24\Lib\site-packages\MySQLdb>setup.py build >> running build >> running build_py >> copying MySQLdb\release.py -> build\lib.win

[Tutor] Generating static WEB sites

2006-04-25 Thread Peter Jessop
I am looking at generating static web pages.What I wish to do is periodically regenerate a WEB site form HTML, text and MySQL data.I have been experimenting with HTMLgen and this seems to be adequate for what I need. However HTMLgen does not seem to have been updated for a while and I was wondering

[Tutor] Problem installing MySQLdb under windows

2006-04-25 Thread Peter Jessop
Thanks Liam and Kent.Problem is now sorted.Which brings me on to my next question... ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Problem installing MySQLdb under windows

2006-04-25 Thread Kent Johnson
Peter Jessop wrote: > I am running Python 2.4.3, MySQL 5.0. > On trying to install MySQLdb 1.2.1 I ran into the following problem. > " > D:\Python24\Lib\site-packages\MySQLdb>setup.py build > running build > running build_py > copying MySQLdb\release.py -> build\lib.win32- 2.4\MySQLdb > running bui

Re: [Tutor] Problem installing MySQLdb under windows

2006-04-25 Thread Liam Clarke
Hi Peter, you can use a different compiler if you have one, such as mingw32, but I find compiling extensions on Windows is very problematic. Any particular features of MySQLdb 1.2.1 you need? 1.2.0 has a Windows version precompiled - http://prdownloads.sourceforge.net/mysql-python/MySQL-python.ex

[Tutor] Problem installing MySQLdb under windows

2006-04-25 Thread Peter Jessop
I am running Python 2.4.3, MySQL 5.0.On trying to install MySQLdb 1.2.1 I ran into the following problem."D:\Python24\Lib\site-packages\MySQLdb>setup.py buildrunning buildrunning build_pycopying MySQLdb\release.py -> build\lib.win32- 2.4\MySQLdbrunning build_exterror: The .NET Framework SDK needs t

Re: [Tutor] need to automate connection

2006-04-25 Thread Kent Johnson
Payal Rathod wrote: > On Tue, Apr 25, 2006 at 06:59:29PM +1200, Liam Clarke wrote: >> Hi Payal, >> >> I see you're connecting to an smtp server Any particular reason yoou >> can't use smtplib? >> http://www.python.org/doc/current/lib/module-smtplib.html > > Because I don't know it exists :) > > B

Re: [Tutor] need to automate connection

2006-04-25 Thread Wolfram Kraus
Payal Rathod wrote: > On Tue, Apr 25, 2006 at 06:59:29PM +1200, Liam Clarke wrote: > >>Hi Payal, >> >>I see you're connecting to an smtp server Any particular reason yoou >>can't use smtplib? >>http://www.python.org/doc/current/lib/module-smtplib.html > > > Because I don't know it exists :) > >

Re: [Tutor] How to compile _tkinter in Fedora Core 4

2006-04-25 Thread John Connors
G'day John, There is a problem with a recent python update and fedora, if you go to http://forums.fedoraforum.org/ and do a search in the forum for tkinter and/or idle you will find the fix. I'm running Fedora Core 5 and found I had to install tkinter, I had to do a yum install tkinter. Jo

Re: [Tutor] need to automate connection

2006-04-25 Thread Payal Rathod
On Tue, Apr 25, 2006 at 06:59:29PM +1200, Liam Clarke wrote: > Hi Payal, > > I see you're connecting to an smtp server Any particular reason yoou > can't use smtplib? > http://www.python.org/doc/current/lib/module-smtplib.html Because I don't know it exists :) But I don't want to send any mail.

Re: [Tutor] Dictionaries and aggregation

2006-04-25 Thread Kent Johnson
> However here's what I'm now trying to do: > > 1) Not have to rely on using awk at all. > > > 2) Create a dictionary with server names for keys e.g. server001, > server002 etc and the aggregate of the request for that server as the value > part of the pairing. > > > I got thi

[Tutor] How to compile _tkinter in Fedora Core 4

2006-04-25 Thread John Hsu
Hi I'd very much appreciate your help if you can advise me how to compile _tkinter in Fedora 4. I installed Fedora core 4 in my machine recently, but struggled to get Tk working for me. The Tcl/Tk is working O.K. because I can run demo programs from /usr/share/tk8.4/demos. The error is caused

Re: [Tutor] Importing Modules

2006-04-25 Thread Kent Johnson
John Connors wrote: > G'day, > > I'm having trouble understanding the difference between, > > import sys > and > from sys import * The second style is strongly discouraged. As Alan pointed out, it can lead to surprises when you import more than you expect. I was once surprised to find out that

Re: [Tutor] Invoking Excel Macro

2006-04-25 Thread Liam Clarke
Hi Arun et al, Google says - http://support.microsoft.com/default.aspx?scid=kb;en-us;210684 "This problem can occur when you give the workbook a defined name and then copy the worksheet several times without first saving and closing the workbook, as in the following sample code..." (code is in ab

Re: [Tutor] need to automate connection

2006-04-25 Thread Liam Clarke
Hi Payal, I see you're connecting to an smtp server Any particular reason yoou can't use smtplib? http://www.python.org/doc/current/lib/module-smtplib.html Here's a sample script using smtplib to send an email - import smtplib ip = "127.0.0.1" txt = "This is an email message" c = smtplib.SMTP(