On Fri, 10 Mar 2006 16:43:15 +0200, rumours say that Juho Schultz
<[EMAIL PROTECTED]> might have written:
>VJ wrote:
>> Hi All
>>
>> Basically i want to write into a file .If the permissions are not there
>> then print a error message.
>> How do i achive this ???
>>
>> Thanks,
>> VJ
>One way w
"VJ" wrote:
> I need to get the user permission of a file using python. I was trying
> the following code which i found on google grups
>
> st = os.stat(myfile)
> mode = st[stat.ST_MODE]
> if mode & stat.ST_IREAD:
> print "readable"
> if mode & stat.ST_IWRITE:
> print
Sebastjan Trepca enlightened us with:
> Those constants are in stat module so add "import stat" before the
> program.
Yeah, but just opening the file is more Pythonic than first checking
if it can be opened in the first place.
Sybren
--
The problem with the world is stupidity. Not saying there s
VJ wrote:
> Hi All
>
> Basically i want to write into a file .If the permissions are not there
> then print a error message.
> How do i achive this ???
>
> Thanks,
> VJ
>
One way would be a try-except block, and leave the permission checking
error message generation, etc. to the operating syst
VJ enlightened us with:
> Basically i want to write into a file .If the permissions are not
> there then print a error message. How do i achive this ???
f = file('somefile', 'w')
then catch the exception that's thrown when it can't be done.
Sybren
--
The problem with the world is stupidity. No
Those constants are in stat module so add "import stat" before the program.
On 10 Mar 2006 06:20:18 -0800, VJ <[EMAIL PROTECTED]> wrote:
> Hi All
>
> I need to get the user permission of a file using python. I was trying
> the following code which i found on google grups
>
> st = os.stat(myfile)
Fredrik Lundh wrote:
> [EMAIL PROTECTED] wrote:
>
> > I'm running python on windows and have a program that watches a
> > directory and acts on files as they come into the directory. After
> > processing is complete, i delete the file, or in this case attempt
> > to
> >
> > In the script versi
[EMAIL PROTECTED] wrote:
> I'm running python on windows and have a program that watches a
> directory and acts on files as they come into the directory. After
> processing is complete, i delete the file, or in this case attempt
> to
>
> In the script version I repeatedly get OSError exceptio
Hi All--
[EMAIL PROTECTED] wrote:
>
> I have noticed a bug that if I have a folder open for viewing in
> Windows Explorer with Thumbnail view enabled that I often run into
> inexplicable problems with modify permissions, say when I want to
> rename or delete an item. Changing the view to Detaile
I have noticed a bug that if I have a folder open for viewing in
Windows Explorer with Thumbnail view enabled that I often run into
inexplicable problems with modify permissions, say when I want to
rename or delete an item. Changing the view to Detailed or rebooting
seems to make the issue go away
Thanks, I will go the win32security.SetFileSecurity route. It seems a
pity that I can't use platform independant code to sort this out but I
guess you're saying that I've managed to get my files into a non
standard state that needs non standard code to sort it out. I wonder
how winamp/itunes manage
barney wrote:
> I realise that theses are windows rather than python issues but I would
> expect there would be some reliable way of changing the file
> permissions from within python. I'm updating ID3 tags in MP3 file to
> give some context. If I use something like winamp to make the change to
>
Thanks,
I tried creating a test file but I get "Access is denied" from windows
explorer! The folder appears to be read only but when I try and uncheck
read only/apply/repopen the folder properties its still read only. This
read only flag seems to propagate down from the My Music directory but
unch
Peter Hansen wrote:
>>
>> Why is python returing True from os.access?
>> Why isn't chmod doing anything?
>
> Check your results using os.stat() after doing that, perhaps? If it
> shows the right values for the permissions, then clearly the problem has
> nothing to do with Python per se, or yo
barney wrote (having trouble with a file):
[snip]
> IOError: [Errno 13] Permission denied: "02 - New Year's Day.mp3"
[snip]
> I'm at a loss to understand what is going on.
>
> Why is python returing True from os.access?
> Why isn't chmod doing anything?
Check your results using os.stat() after do
15 matches
Mail list logo