Re: Changing directories in oswalk [was Re: Walk thru each subdirectory from a top directory]

2007-03-02 Thread Peter Otten
Steven D'Aprano wrote: > For those times when os.walk's behaviour doesn't mesh well with that of > the external program you are calling (like macunpack) is there an > alternative to: > > - save the cwd; > - change directories; > - call the program; > - return to the saved directory > > ? os.wal

Re: Changing directories in oswalk [was Re: Walk thru each subdirectory from a top directory]

2007-02-28 Thread Steven D'Aprano
On Wed, 28 Feb 2007 08:38:41 +0100, Peter Otten wrote: > Does the problem occur if you pass an absolute path to > os.walk()/os.path.walk()? Well, arguably the problem is that macunpack insists on writing to the current working directory. Or the problem is that os.walk sets the working directory

Re: Changing directories in oswalk [was Re: Walk thru each subdirectory from a top directory]

2007-02-27 Thread Peter Otten
Steven D'Aprano wrote: > On Tue, 27 Feb 2007 20:31:43 -0800, Scott David Daniels wrote: > >>> def findallfiles(self, base): >>> self.results = [] >>> for root,dirs,files in os.walk(base): >>> os.chdir(root) >>^^^ Mistake here, don't change directories durin

Re: Walk thru each subdirectory from a top directory

2007-02-27 Thread Steven D'Aprano
On Tue, 27 Feb 2007 06:22:51 +, Dennis Lee Bieber wrote: [snip 350-odd file names] > Just a sample of the start of a very long listing... Thanks for sharing. What's with the nude ferret? -- Steven D'Aprano -- http://mail.python.org/mailman/listinfo/python-list

Changing directories in oswalk [was Re: Walk thru each subdirectory from a top directory]

2007-02-27 Thread Steven D'Aprano
On Tue, 27 Feb 2007 20:31:43 -0800, Scott David Daniels wrote: >> def findallfiles(self, base): >> self.results = [] >> for root,dirs,files in os.walk(base): >> os.chdir(root) >^^^ Mistake here, don't change directories during os.walk ^^^ I came across this

Re: Walk thru each subdirectory from a top directory

2007-02-27 Thread Scott David Daniels
Adam wrote: > On Feb 26, 9:28 pm, [EMAIL PROTECTED] wrote: >> i am trying to use python to walk thru each subdirectory from a top >> directory. Here is my script: > > This bit below is from one of my first programs as I'm currently > learning. It is designed

Re: Walk thru each subdirectory from a top directory

2007-02-26 Thread Adam
Whoops, the first bit of my reply ended up in the quoted text. See above. Adam -- http://mail.python.org/mailman/listinfo/python-list

Re: Walk thru each subdirectory from a top directory

2007-02-26 Thread Adam
On Feb 26, 9:28 pm, [EMAIL PROTECTED] wrote: > i am trying to use python to walk thru each subdirectory from a top > directory. Here is my script: > > savedPagesDirectory = "/home/meryl/saved_pages/data" > > dir=open(savedPagesDirectory, 'r') >

Re: Walk thru each subdirectory from a top directory

2007-02-26 Thread Jeff McNeil
_action(path) # - # Run it list_dir(deldir, del_entry) On 26 Feb 2007 13:28:20 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: i am trying to use python to walk thru each subdirectory from a top directory. Here is my script: save

Re: Walk thru each subdirectory from a top directory

2007-02-26 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > i am trying to use python to walk thru each subdirectory from a top > directory. Here is my script: > > savedPagesDirectory = "/home/meryl/saved_pages/data" > > dir=open(savedPagesDirectory, 'r') > > for file in dir: >

Re: Walk thru each subdirectory from a top directory

2007-02-26 Thread Sick Monkey
#print path _action(path) # - # Run it list_dir(deldir, del_entry) On 26 Feb 2007 13:28:20 -0800, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: i am trying to use python to walk thru each subd

Walk thru each subdirectory from a top directory

2007-02-26 Thread silverburgh . meryl
i am trying to use python to walk thru each subdirectory from a top directory. Here is my script: savedPagesDirectory = "/home/meryl/saved_pages/data" dir=open(savedPagesDirectory, 'r') for file in dir: if (isdir(file)): # get the full path of the f