Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20977 > unrolled thread

Re: check if directory is writable in a portable way

Started byTim Chase <python.list@tim.thechases.com>
First post2012-02-28 06:12 -0600
Last post2012-02-28 06:12 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: check if directory is writable in a portable way Tim Chase <python.list@tim.thechases.com> - 2012-02-28 06:12 -0600

#20977 — Re: check if directory is writable in a portable way

FromTim Chase <python.list@tim.thechases.com>
Date2012-02-28 06:12 -0600
SubjectRe: check if directory is writable in a portable way
Message-ID<mailman.224.1330431141.3037.python-list@python.org>
On 02/28/12 06:01, Andrea Crotti wrote:
>>> How should I check if I can create files in a directory?
>
> But isn't there (or should there be) a windows-related library that
> abstracts this horrible things?

Yes, there should be. There isn't as far as I know (though that 
doesn't mean much given my limited experiences in the recesses of 
Win32 APIs).

Additionally, even if you did a LBYL instead, you'd open yourself 
to a race-condition where the permissions could theoretically 
change between the time you check and the time you actually try 
to write there.  Granted, that's a slim chance and usually would 
be a "Doctor, my foot hurts when I do $THIS"/"Well don't do that" 
situation where the solution is "don't change the permissions 
while running this program".

-tkc


[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web