Re: [Tutor] map() and lambda to change class instance attribute (fwd)

2005-05-12 Thread Alan Gauld
> now I always used map() to perform a looped call on a function that > would change the attribute value, as shown in Mark Lutz & David > Ascher's Learning Python: > > # Perform attribute value change on a single instance > def iterateInstances( oInstance ): > oInstance.value = myValue > > #

Re: [Tutor] Help with Challenge number 5

2005-05-12 Thread Max Noel
On May 13, 2005, at 01:30, Jacob S. wrote: > Okay, I've tried pickling, marshal, marshalling, serialization, and > amazingly pi because I noticed that pickle was under the section 3.14 > however, none of this worked, so, I hate to ask again but, could > you go one > step farther? > > Thanx, > J

Re: [Tutor] Help with Challenge number 5

2005-05-12 Thread Jacob S.
Okay, I've tried pickling, marshal, marshalling, serialization, and amazingly pi because I noticed that pickle was under the section 3.14 however, none of this worked, so, I hate to ask again but, could you go one step farther? Thanx, Jacob ___ Tuto

[Tutor] help: threading + cron in python?

2005-05-12 Thread Aaron
Lets say you have a threaded program. Is there any way to make it so that an operation occurs at a certain time every hour (eg) like the cron daemon? I'm afraid I don't really understanding threading enought to make this work.. ___ Tutor maillist - Tu

Re: [Tutor] Help with Challenge number 5

2005-05-12 Thread Roel Schroeven
Jacob S. wrote: > Is there anyone on the list right now who knows what to do with > > yes! pickle! > > on challenge number 5 -- Any hints appreciated. > > I've tried the most common combinations of yes and pickle in the url path, > but to no avail. Have a look at the module index in the pytho

[Tutor] Help with Challenge number 5

2005-05-12 Thread Jacob S.
Is there anyone on the list right now who knows what to do with yes! pickle! on challenge number 5 -- Any hints appreciated. I've tried the most common combinations of yes and pickle in the url path, but to no avail. By the way, this means I solved challenge 4. TIA, Jacob __

Re: [Tutor] Why use apply()?

2005-05-12 Thread Bob Gailer
At 02:17 PM 5/12/2005, Bernard Lebel wrote: Just a generic question: why one would use apply()? In Learning Python, on page 357, there is an example of generating an instance using apply(): class A:   def __init__( self, number ): self.number = number a = apply( A, 3 ) What is th

Re: [Tutor] [unclassified] Re: Pipe variable to external command (fwd)

2005-05-12 Thread Danny Yoo
> In my first example, clamdscan should return 1 when the EICAR string is > found -- process.wait() gets 256 instead. In the second, clamdscan > returns 2 if an error occurs, such as trying to scan a non-existent > file, but 512 is returned. > > No doubt there is a reason why the exit code is get

[Tutor] Compare hours

2005-05-12 Thread Alberto Troiano
Hey everyone I have a question. I need to compare two dates and times but it has to be quick. (With quick I mean that the algorythm has to be simple in efficient Here is the deal: day="thursday" hour1="15:30" hour2="16:30" all of the above are strings I have to get the system date and time an

Re: [Tutor] Compare hours

2005-05-12 Thread Bob Gailer
At 03:01 PM 5/12/2005, Alberto Troiano wrote: Hey everyone I have a question. I need to compare two dates and times but it has to be quick. (With quick I mean that the algorythm has to be simple in efficient Here is the deal: day="thursday" hour1="15:30" hour2="16:30" all of the above are string

Re: [Tutor] #NameError: global name is not defined

2005-05-12 Thread Jacob S.
> Hi, > > I'm having difficulty understanding why the following code doesn't work: > > > getfr.py > #import pymetar > # > #class wReport: > #def __init__(self,metarcode="CYYC"): #weather for calgary INTL > #self.METARCODE=metarcode > #rf=pymetar.ReportFetcher(self.METARCODE) > #

Re: [Tutor] [unclassified] Re: Pipe variable to external command (fwd)

2005-05-12 Thread Jeffrey Rice
At 12:24 PM 5/12/2005, Danny Yoo wrote: >## > >>> import popen2 > >>> process = popen2.Popen3(['wc']) > >>> process.tochild.write("hello\nworld") > >>> process.tochild.close() > >>> process.fromchild.read() >' 1 2 11\n' > >>> process.fromchild.close() > >>> process.wait() >0 >#

Re: [Tutor] *nix-specific Python Scripting [Off Topic]

2005-05-12 Thread ZIYAD A. M. AL-BATLY
On Thu, 2005-05-12 at 13:37 -0400, William O'Higgins wrote: > I am trying to learn Python by translating some of my Perl scripts. One > thing that is eluding me is assigning the results of system calls to > variables. Here's what I want to do in Perl: > > $isxrunning = `ps -C startx | gr

[Tutor] Why use apply()?

2005-05-12 Thread Bernard Lebel
Just a generic question: why one would use apply()? In Learning Python, on page 357, there is an example of generating an instance using apply(): class A: def __init__( self, number ): self.number = number a = apply( A, 3 ) What is the benefit of doing this over simply crea

Re: [Tutor] any help with this piece of code

2005-05-12 Thread Danny Yoo
On Thu, 12 May 2005, Richard gelling wrote: > fileToSearchFor = raw_input( "Type in the file name you want to search > for: ") > > if fileToSearchFor in fileList: > print "%s was found" % fileToSearchFor > else: > print "%s was not found" % fileToSearchFor > > Could someone explain to me

Re: [Tutor] *nix-specific Python Scripting

2005-05-12 Thread William O'Higgins
On Thu, May 12, 2005 at 09:37:03PM +0200, Roel Schroeven wrote: >William O'Higgins wrote: >> It is a simple check to see if the X server is running (this is >> inelegant, but it works - if you have a better way, I'd love to know >> about it, but I would like to be able to do things like this in Pyt

[Tutor] any help with this piece of code

2005-05-12 Thread Richard gelling
import os fileList = [] subDirectories = [] directories = [] directoryPath = raw_input( "Type in the path you want to start at: " ) for directory,subDirectory, files in os.walk( directoryPath ): directories.append( directory ) subDirectories.append( subDirectory ) fileList.append( fil

Re: [Tutor] *nix-specific Python Scripting

2005-05-12 Thread Roel Schroeven
William O'Higgins wrote: > It is a simple check to see if the X server is running (this is > inelegant, but it works - if you have a better way, I'd love to know > about it, but I would like to be able to do things like this in Python - > so I might better write scripts with it). Checking for star

Re: [Tutor] Pipe variable to external command (fwd)

2005-05-12 Thread Danny Yoo
> http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/68786 > As a work around, I end up calling popen3 like this: > > Open3.popen3 ("/some/command/to/run ; echo $? 1>&2") { ... } > > That ensures the exit code from /some/command/to/run will be the last > line of the standard error stream from

Re: [Tutor] Pipe variable to external command (fwd)

2005-05-12 Thread Jeffrey Rice
At 11:56 AM 5/12/2005, Danny Yoo wrote: >* * * * >CLAMAV_out, CLAMAV_in, CLAMAV_err= popen2.popen3(CLAMAV) >CLAMAV_in.write(WORKING) >CLAMAV_in.close() >CLAM_RESULT=CLAMAV_out.read() >CLAMAV_out.close() >CLAM_ERR=CLAMAV_err.read() >CLAMAV_err.close() >* * * * > >CLAM_RESULT gives the correct reply

Re: [Tutor] help with tabs and Tkinter

2005-05-12 Thread Danny Yoo
On Thu, 12 May 2005, Zenten wrote: > Ok, I'm writing a program using tkinter, that has a bit of data entry in > it. It would be useful to have a window with various tabs to select > between different "pages" in my entry. However, I can't figure out how > to do this part, after looking through

Re: [Tutor] *nix-specific Python Scripting

2005-05-12 Thread Danny Yoo
On Thu, 12 May 2005, William O'Higgins wrote: > I am trying to learn Python by translating some of my Perl scripts. One > thing that is eluding me is assigning the results of system calls to > variables. Here's what I want to do in Perl: > > $isxrunning = `ps -C startx | grep "startx"`; >

Re: [Tutor] Pipe variable to external command (fwd)

2005-05-12 Thread Danny Yoo
-- Forwarded message -- Date: Thu, 12 May 2005 11:31:57 -0600 From: Jeffrey Rice <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Pipe variable to external command At 12:16 AM 5/12/2005, Danny Yoo wrote: >## > >>> child_out, child_in = popen2.popen2

[Tutor] help with tabs and Tkinter

2005-05-12 Thread Zenten
Ok, I'm writing a program using tkinter, that has a bit of data entry in it. It would be useful to have a window with various tabs to select between different "pages" in my entry. However, I can't figure out how to do this part, after looking through documentation. Can anyone help? Joshua _

[Tutor] *nix-specific Python Scripting

2005-05-12 Thread William O'Higgins
I am trying to learn Python by translating some of my Perl scripts. One thing that is eluding me is assigning the results of system calls to variables. Here's what I want to do in Perl: $isxrunning = `ps -C startx | grep "startx"`; if ($isxrunning =~ "startx") { do somet

Re: [Tutor] character format

2005-05-12 Thread Max Noel
On May 12, 2005, at 03:00, [EMAIL PROTECTED] wrote: > As was pointed out, I'm not American. I guess the problem stems > from an > American cultural assumption, though, in that Americans (I think) > developed the > ASCII character set without any thought for other languages. At that tim

Re: [Tutor] character format

2005-05-12 Thread Max Noel
On May 12, 2005, at 02:42, Tony Meyer wrote: >> >> From the email address, chances are that this was a New Zealand >> cultural >> > assumption. Ah, the French, lumping all English speakers under the > American > banner . Touché. :D -- Max ( What makes it even more unforgivable is that

Re: [Tutor] dicts&lists vs objects

2005-05-12 Thread Liam Clarke
Is some form of SQL database feasible? It sounds more like what you need. Depends on what you're storing, and how much. Cheers, Liam ClarkeOn 5/12/05, Chris Somerlot <[EMAIL PROTECTED]> wrote: I have been working on a scientific application for awhile, and have been using dictionaries and lists

Re: [Tutor] dicts&lists vs objects

2005-05-12 Thread Smith, Jeff
Those are good observations and I think answers part of the question. I think the other part is that even in OO code, how do you know what to make an object and what to just store in an existing data type like a list or dictionary. Personally, I use the "if it walks like a duck" rule. In other

Re: [Tutor] py2exe

2005-05-12 Thread jfouhy
Quoting "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>: > I was wondering if someone knows of a better way to make an exe file > out of python code. I would like to have just one exe file that once you > run no other windows will pop up other than your application. If you use > py2exe this will open up a

Re: [Tutor] #NameError: global name is not defined

2005-05-12 Thread Kent Johnson
Aaron Elbaz wrote: > Hi, > > I'm having difficulty understanding why the following code doesn't work: > > > getfr.py > #import pymetar > # > #class wReport: > #def __init__(self,metarcode="CYYC"): #weather for calgary INTL > #self.METARCODE=metarcode > #rf=pymetar.ReportFetch

Re: [Tutor] dicts&lists vs objects

2005-05-12 Thread Andrei
Chris Somerlot gmail.com> writes: > is a premutation of another, and I'm having trouble following the code > I've written. > Is there a golden rule to knowing when to use objects instead of dictionaries and lists? It all depends on the programmer, the project, etc. I'd say that the fact that you

[Tutor] py2exe

2005-05-12 Thread ray007
Hi I was wondering if someone knows of a better way to make an exe file out of python code. I would like to have just one exe file that once you run no other windows will pop up other than your application. If you use py2exe this will open up a DOS prompt which is not the desired output. Does any

[Tutor] #NameError: global name is not defined

2005-05-12 Thread Aaron Elbaz
Hi, I'm having difficulty understanding why the following code doesn't work: getfr.py #import pymetar # #class wReport: #def __init__(self,metarcode="CYYC"): #weather for calgary INTL #self.METARCODE=metarcode #rf=pymetar.ReportFetcher(self.METARCODE) #rep=rf.FetchRep

Re: [Tutor] total newbie [profiling example]

2005-05-12 Thread Danny Yoo
On Wed, 11 May 2005, Michael Cole wrote: > What I noticed while testing the program is that the ball moves fairly > slowly, I tried incrementing the ball's speed (dx and dy) but it still > seemed to move pretty slow no matter how much I increased its speed. I > went ahead and played out the game