Code For Five Threads To Process Multiple Files?

2008-05-21 Thread tdahsu
All, I'd appreciate any help. I've got a list of files in a directory, and I'd like to iterate through that list and process each one. Rather than do that serially, I was thinking I should start five threads and process five files at a time. Is this a good idea? I picked the number five at ran

Re: Code For Five Threads To Process Multiple Files?

2008-05-21 Thread tdahsu
On May 21, 11:13 am, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2008-05-21, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I'd appreciate any help.  I've got a list of files in a directory, and > > I'd like to iterate through that list and process each one.  Rather > > than do that serially,

Re: Code For Five Threads To Process Multiple Files?

2008-05-22 Thread tdahsu
On May 21, 11:41 am, [EMAIL PROTECTED] wrote: > On May 21, 11:13 am, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > > > > > On 2008-05-21, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > I'd appreciate any help.  I've got a list of files in a directory, and > > > I'd like to iterate through that l

Re: Code For Five Threads To Process Multiple Files?

2008-05-23 Thread tdahsu
On May 23, 12:20 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 22 May 2008 11:03:48 -0700 (PDT), [EMAIL PROTECTED] declaimed the > following in comp.lang.python: > > > Ah, well, I didn't get any other responses, but here's what I've done: > >         Apparently the direct email from my

File-writing not working in Windows?

2008-06-06 Thread tdahsu
All, I have the following code: for fileTarget in dircache.listdir("directory"): (dirName, fileName) = os.path.split(fileTarget) f = open(fileTarget).readlines() copying = False for i in range(len(f)): f

Re: File-writing not working in Windows?

2008-06-06 Thread tdahsu
On Jun 6, 11:35 am, jay graves <[EMAIL PROTECTED]> wrote: > On Jun 6, 10:18 am, [EMAIL PROTECTED] wrote: > > > > This code works PERFECTLY in Linux.  Where I have a match in the file > > I'm processing, it gets cut out from the start of the match until the > > end of the match, and written to the

Re: File-writing not working in Windows?

2008-06-06 Thread tdahsu
On Jun 6, 2:58 pm, jay graves <[EMAIL PROTECTED]> wrote: > On Jun 6, 1:22 pm, [EMAIL PROTECTED] wrote: > > > I am thinking that the "g.open(tempFileName, 'a')" command is the > > issue.  Is there anything different about opening a file in Windows? > > Does Windows understand "append", or would I ha

Re: File-writing not working in Windows?

2008-06-08 Thread tdahsu
On Jun 8, 4:11 am, Lie <[EMAIL PROTECTED]> wrote: > On Jun 6, 10:18 pm, [EMAIL PROTECTED] wrote: > > > > > > > All, > > > I have the following code: > >            for fileTarget in dircache.listdir("directory"): > >                 (dirName, fileName) = os.path.split(fileTarget) > >              

Iterate creating variables?

2008-06-13 Thread tdahsu
I have twenty-five checkboxes I need to create (don't ask): self.checkbox1 = ... self.checkbox2 = ... . . . self.checkbox25 = ... Right now, my code has 25 lines in it, one for each checkbox, since these are all variables. Is there a way to write a loop so that I can have fewer lines of code but

Re: Iterate creating variables?

2008-06-13 Thread tdahsu
On Jun 13, 11:21 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > I have twenty-five checkboxes I need to create (don't ask): > > > self.checkbox1 = ... > > self.checkbox2 = ... > > . > > . > > . > > self.checkbox25 = ... > > > Right now, my code has 25 lines

Re: Iterate creating variables?

2008-06-13 Thread tdahsu
On Jun 13, 11:48 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > On Jun 13, 11:21 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > > >>> I have twenty-five checkboxes I need to create (don't ask): > >>> self.checkbox1 = ...

Re: Iterate creating variables?

2008-06-13 Thread tdahsu
On Jun 13, 12:03 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > Thank you, this is much closer to where I need to be... > > > The issue is (and this is the part that you don't know, because I > > didn't tell you!) is that I later need to call methods on > > "self.checkbox1", for instance: >

Re: Iterate creating variables?

2008-06-13 Thread tdahsu
On Jun 13, 12:19 pm, Calvin Spealman <[EMAIL PROTECTED]> wrote: > On Jun 13, 2008, at 11:56 AM, [EMAIL PROTECTED] wrote: > > > > > On Jun 13, 11:48 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > > >>> On Jun 13, 11:21 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> w

os.walk Value Error?

2008-06-14 Thread tdahsu
Hi, I'm using os.walk as follows: (basedir, pathnames, files) = os.walk("results", topdown=True) and I'm getting the error: ValueError: too many values to unpack >From my googling, that means: This is the standard message when Python tries to unpack a tuple into fewer variables than are in th

Re: Avoiding redirects with urllib

2008-06-14 Thread tdahsu
On Jun 14, 5:22 pm, Fernando Rodriguez <[EMAIL PROTECTED]> wrote: > Hi, > > I'musing urllib to download pages from a site. How can I detect if a given > url is being redirected somewhere else? I want to avoid this, is it possible? > > Thanks in advance! Try this: import urllib url_opener = urllib

Re: Avoiding redirects with urllib

2008-06-14 Thread tdahsu
On Jun 14, 6:18 pm, [EMAIL PROTECTED] wrote: > On Jun 14, 5:22 pm, Fernando Rodriguez > > <[EMAIL PROTECTED]> wrote: > > Hi, > > > I'musing urllib to download pages from a site. How can I detect if a given > > url is being redirected somewhere else? I want to avoid this, is it > > possible? > > >

Re: os.walk Value Error?

2008-06-14 Thread tdahsu
On Jun 14, 7:11 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hi, > > > I'm using os.walk as follows: > > > (basedir, pathnames, files) = os.walk("results", topdown=True) > > > and I'm getting the error: > > > ValueError: too many values to unpack > > > From my googling,