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 ??
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
>
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 t
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 menti
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
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 item
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
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' % c
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
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'
os.remove
10 matches
Mail list logo