[OT] .DS_Store files (was Re: Removing .DS_Store files from mac folders)

2006-03-09 Thread Dan Sommers
On Thu, 09 Mar 2006 17:19:15 +1300, Greg Ewing [EMAIL PROTECTED] wrote: I don't think that deleting the .DS_Store files is the right approach to this, for various reasons: [ ... ] * It might not even work, since the .DS_Store could get re-created in between your purge and creating the

Re: [OT] .DS_Store files (was Re: Removing .DS_Store files from mac folders)

2006-03-09 Thread Eric Deveaud
Dan Sommers wrote: If these are both true, then *new* .DS_Store files could be created after I've made the list and before I've made the tarball. not python related, but in order to creater the tarball without the .DS_Store files why don't you use the --exclude=PATTERN option from tar ??

Re: Removing .DS_Store files from mac folders

2006-03-08 Thread Greg Ewing
David Pratt wrote: Hi Ben. I hadn't realize that walk was just giving the file name so the join did the job just great. I don't think that deleting the .DS_Store files is the right approach to this, for various reasons: * You're messing with MacOSX's metadata, which is not a nice thing to

Re: Removing .DS_Store files from mac folders

2006-03-02 Thread David Pratt
Hi Ben. I hadn't realize that walk was just giving the file name so the join did the job just great. Many thanks for helping me out with this. Regards, David Ben Cartwright wrote: David Pratt wrote: OSError: [Errno 2] No such file or directory: '.DS_Store' Ah. You didn't mention a

Removing .DS_Store files from mac folders

2006-03-01 Thread David Pratt
Hi. I'm trying to clean files for packaging on mac using os.path.walk and want to clean the .DS_Store files that are hidden from view but could end up in code that I produce. # Clean mac .DS_Store if current_file == '.DS_Store': print 'a DS_Store item encountered'

Re: Removing .DS_Store files from mac folders

2006-03-01 Thread Ben Cartwright
David Pratt wrote: # Clean mac .DS_Store if current_file == '.DS_Store': print 'a DS_Store item encountered' os.remove(f) ... I can't figure why remove is not removing. It looks like your indentation is off. From what you posted, the print line is prepended with 9

Re: Removing .DS_Store files from mac folders

2006-03-01 Thread David Pratt
Hi Ben. Sorry about the cut and paste job into my email. It is part of a larger script. It is actually all tabbed. This will give you a better idea: for f in file_names: current_file = os.path.basename(f) print 'Current File: %s' %

Re: Removing .DS_Store files from mac folders

2006-03-01 Thread Ben Cartwright
David Pratt wrote: Hi Ben. Sorry about the cut and paste job into my email. It is part of a larger script. It is actually all tabbed. This will give you a better idea: for f in file_names: current_file = os.path.basename(f) print

Re: Removing .DS_Store files from mac folders

2006-03-01 Thread David Pratt
My apologies Ben. I should have included the traceback in my message. The last line of the traceback I get from python when it gets to os.remove is OSError: [Errno 2] No such file or directory: '.DS_Store' The traceback occurs immediately after printing: Current File: .DS_Store a DS_Store

Re: Removing .DS_Store files from mac folders

2006-03-01 Thread Ben Cartwright
David Pratt wrote: OSError: [Errno 2] No such file or directory: '.DS_Store' Ah. You didn't mention a traceback earlier, so I assumed the code was executing but you didn't see the file being removed. for f in file_names: current_file = os.path.basename(f)