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 'Current File: %s' % current_file
>
>                       # Clean mac .DS_Store
>                       if current_file == '.DS_Store':
>                               print 'a DS_Store item encountered'
>                               os.remove(f)


I'm no Mac expert, but could it be that OSX is recreating .DS_Store?
Try putting this above your os.remove call:

  import os.stat
  print 'Last modified:', os.stat(f)[ST_MTIME]

Then run your script a few times and see if the modified times are
different.

You might also try verifying that you get an exception when attempting
to open the file right after removing it.

--Ben

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to