Re: asyncio: setting file permissions of a Unix socket?

2014-10-27 Thread Michael Ströder
Martin wrote: > I'm using the asyncio.Protocol interface to build a server which binds > to a unix socket file. I want other system users to connect to the > unix socket, so to communicate with the server. > > Where should I set the permissions of the file? You should start the demon with a stri

asyncio: setting file permissions of a Unix socket?

2014-10-27 Thread Martin
when the programs starts listening for the connections. Because of this, I can't change the file permission before a connection is made. At the same time, a connection can't happen because of the file permissions. Currently, I workaround this with os.umask(0o000). But I also want to m

Re: Reading and setting file permissions programmatically

2009-06-17 Thread Kushal Kumaran
On Thu, Jun 18, 2009 at 2:05 AM, Cameron Pulsford wrote: > Sorry to flood the list but my google fu isn't up to par today I guess. > Basically, is it possible to read the permissions on one file and then set > the permissions of another file to the ones we just read? os.dup2 seemed > like it would

Re: Reading and setting file permissions programmatically

2009-06-17 Thread MRAB
Cameron Pulsford wrote: Sorry to flood the list but my google fu isn't up to par today I guess. Basically, is it possible to read the permissions on one file and then set the permissions of another file to the ones we just read? os.dup2 seemed like it would work but I might not be using it cor

Reading and setting file permissions programmatically

2009-06-17 Thread Cameron Pulsford
Sorry to flood the list but my google fu isn't up to par today I guess. Basically, is it possible to read the permissions on one file and then set the permissions of another file to the ones we just read? os.dup2 seemed like it would work but I might not be using it correctly. I know there is os.c

Re: mailbox.mbox.add() also seems to set file permissions

2009-04-27 Thread tinnews
Aahz wrote: > In article , > Grant Edwards wrote: > >On 2009-04-25, tinn...@isbd.co.uk wrote: > >> > >> Where should one report bugs/errors in python library classes? > > > >http://docs.python.org/bugs.html > > That's for doc bugs; regular bugs go to bugs.python.org (which is > currently down

Re: mailbox.mbox.add() also seems to set file permissions

2009-04-26 Thread Aahz
In article , Grant Edwards wrote: >On 2009-04-25, tinn...@isbd.co.uk wrote: >> >> Where should one report bugs/errors in python library classes? > >http://docs.python.org/bugs.html That's for doc bugs; regular bugs go to bugs.python.org (which is currently down due to hardware problems). -- Aa

Re: mailbox.mbox.add() also seems to set file permissions

2009-04-25 Thread Grant Edwards
On 2009-04-25, tinn...@isbd.co.uk wrote: > Where should one report bugs/errors in python library classes? http://docs.python.org/bugs.html -- Grant Edwards grante Yow! Gee, I feel kind of at LIGHT in the head now,

mailbox.mbox.add() also seems to set file permissions

2009-04-25 Thread tinnews
mailbox.mbox.add() has *another* 'quirk'. When it adds a message to an mbox file it seems to set the permissions to 0755 which is quite wrong for mbox files. I get the feeling that the mbox versions of the functions are just bodged maildir ones. If one was creating a maildir it *might* make some

Preserving file permissions with distutils

2009-01-14 Thread George Sakkis
I'm trying to use distutils to install some package data and additional files, some of which may be executable. It turns out that distutils does not preserve the permissions. Digging in the code, there is the following comment on distutils/command/build_py: # XXX copy_file by default prese

Re: Checking File permissions

2006-07-21 Thread Tal Einat
Anoop wrote: > Hi All > > Please tell me how to check the existence of a file and the read > permission to the file using python script > > Thanks for ur inputs > > Anoop os.access(path, mode) does just this, check it out. Cross-platform-ness isn't a problem, the docs say it is available for Win

Re: Checking File permissions

2006-07-20 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Anoop wrote: > Please tell me how to check the existence of a file and the read > permission to the file using python script Without knowing what your precise needs are, the best way is to open the file and try to read from it. If that succeeds, then you've got rea

Re: Checking File permissions

2006-07-20 Thread Larry Bates
Note: You really don't have to post the same question 3 times (2 in response to yourself). import os if os.path.exists(pathname): To see if a file is writeable: import stat def iswriteable(path): mode=os.stat(path)[stat.ST_mode] return bool(stat.S_IMODE(mode) & stat.S_IWRITE) Larr

Re: Checking File permissions

2006-07-20 Thread Avell Diroll
Anoop wrote: > Please tell me how to check the existence of a file and the read > permission to the file using python script You can check the os module (os.stat comes to mind). For an exemple you can have a look at : http://www.pixelbeat.org/talks/python/ls.py Regards, Avell -- http://mail.py

Checking File permissions

2006-07-20 Thread Anoop
Hi All Please tell me how to check the existence of a file and the read permission to the file using python script Thanks for ur inputs Anoop -- http://mail.python.org/mailman/listinfo/python-list

Checking File permissions

2006-07-20 Thread Anoop
Hi All Please tell me how to check the existence of a file and the read permission to the file using python script Thanks for ur inputs Anoop -- http://mail.python.org/mailman/listinfo/python-list

Checking File permissions

2006-07-20 Thread Anoop
Hi All Please tell me how to check the existence of a file and the read permission to the file using python script Thanks for ur inputs Anoop -- http://mail.python.org/mailman/listinfo/python-list

Re: setting file permissions on a web server

2006-04-30 Thread Martin P. Hellwig
John Salerno wrote: Most FTP servers do allow to use chmod in a ftp session, although you're client must support it. See for example a cli ftp client (and server) on FreeBSD. > [EMAIL PROTECTED]:~$ ftp ftp.xs4all.nl > Connected to ftp2.xs4all.nl. > 220 XS4ALL ftpd DCLXVI > Name (ftp.xs4all.nl:

Re: setting file permissions on a web server

2006-04-30 Thread John Salerno
Daniel Nogradi wrote: > This depends on your arrangements with your web server provider. > Perhaps you are allowed to ssh into that machine, perhaps not, you > need to ask your provider. In case you can use ssh, then you can log > in with putty (an ssh client for windows, grab it from here: > http

Re: setting file permissions on a web server

2006-04-30 Thread Kirk McDonald
Daniel Nogradi wrote: > I have next to zero experience with windows but as far as I know > windows doesn't have file permissions at all (anyone, please correct > me if I'm wrong :)) so in windows land it doesn't make any sense to > "change file permissions". Ev

Re: setting file permissions on a web server

2006-04-30 Thread Edward Elliott
Daniel Nogradi wrote: > I have next to zero experience with windows but as far as I know > windows doesn't have file permissions at all (anyone, please correct > me if I'm wrong :)) so in windows land it doesn't make any sense to > "change file permissions"

Re: setting file permissions on a web server

2006-04-30 Thread Edward Elliott
John Salerno wrote: > Thanks, but I'm still a little confused. Since I'm running Windows You misplaced your period, it goes at the end of that line. ;) > assume that I can't run the chmod line on my own computer. Sure you can, install cygwin. chmod only affects files on your computer, and won'

Re: setting file permissions on a web server

2006-04-30 Thread Daniel Nogradi
you are root you > > can do it in any case. Depending on your ftp, scp, http or whatever > > method you use to transfer files the file permissions may or may not > > change during the transfer. If permissions are kept intact you can > > chmod on your local machine and then

Re: setting file permissions on a web server

2006-04-30 Thread Diez B. Roggisch
> I suppose I could write a script that would set the permissions of all > the files in a particular folder on my computer to 755, but is there a > Windows equivalent command for chmod to do this? Or am I stuck having to > do it on the server side? The chmod has to be executed on the machine th

Re: setting file permissions on a web server

2006-04-30 Thread John Salerno
t if you are root you > can do it in any case. Depending on your ftp, scp, http or whatever > method you use to transfer files the file permissions may or may not > change during the transfer. If permissions are kept intact you can > chmod on your local machine and then transfer, if

Re: setting file permissions on a web server

2006-04-30 Thread Daniel Nogradi
> I always read about how you need to set certain file permissions (for > cgi files, for example), but it's never been clear to me *how* you do > this. I know you can run the line > > chmod 755 scriptname.py > > but *where* do you run this? Is this done on your personal

Re: setting file permissions on a web server

2006-04-30 Thread Rene Pijlman
John Salerno: >I always read about how you need to set certain file permissions (for >cgi files, for example), but it's never been clear to me *how* you do >this. I know you can run the line > >chmod 755 scriptname.py > >but *where* do you run this? This is a Unix/Li

setting file permissions on a web server

2006-04-29 Thread John Salerno
I always read about how you need to set certain file permissions (for cgi files, for example), but it's never been clear to me *how* you do this. I know you can run the line chmod 755 scriptname.py but *where* do you run this? Is this done on your personal system, or on the server? Wh

Re: File Permissions

2006-03-18 Thread Christos Georgiou
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

Re: File Permissions

2006-03-10 Thread Fredrik Lundh
"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

Re: File Permissions

2006-03-10 Thread Sybren Stuvel
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

Re: File Permissions

2006-03-10 Thread Juho Schultz
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

Re: File Permissions

2006-03-10 Thread Sybren Stuvel
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

Re: File Permissions

2006-03-10 Thread Sebastjan Trepca
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)

File Permissions

2006-03-10 Thread VJ
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) mode = st[stat.ST_MODE] if mode & stat.ST_IREAD: print "readable" if mode & stat.ST_IWRITE: print "writable" if mode

Re: Getting File Permissions

2006-03-07 Thread Tim Chase
> Traceback (most recent call last): > File "", line 1, in ? > NameError: name 'octal' is not defined > > Since I am new to python, can any one help me to solve this error? Looks like you just want the oct() function (not "octal()") >>> [x for x in dir(__builtins__) if x.lower().find("oct") !

Re: Getting File Permissions

2006-03-07 Thread Juho Schultz
Hari wrote: > Hi, > For getting permissions of a file, the following script has been > suggested in the same group > > import os, stat > st = os.stat(myfile) > mode = st[stat.ST_MODE] > print "mode is", octal(mode & 0777) > > But while executing I am getting error message as follows > > Tracebac

Re: Getting File Permissions

2006-03-07 Thread Kent Johnson
Hari wrote: > Hi, > For getting permissions of a file, the following script has been > suggested in the same group > > import os, stat > st = os.stat(myfile) > mode = st[stat.ST_MODE] > print "mode is", octal(mode & 0777) > > But while executing I am getting error message as follows > > Tracebac

Getting File Permissions

2006-03-07 Thread Hari
Hi, For getting permissions of a file, the following script has been suggested in the same group import os, stat st = os.stat(myfile) mode = st[stat.ST_MODE] print "mode is", octal(mode & 0777) But while executing I am getting error message as follows Traceback (most recent call last): File "",

Re: File permissions script vs shell

2006-01-31 Thread jdlists
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

Re: File permissions script vs shell

2006-01-31 Thread Fredrik Lundh
[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

File permissions script vs shell

2006-01-31 Thread jdlists
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 exceptions stating permission denied when try

Re: zipfile and file permissions

2006-01-23 Thread Pete Forman
Robert Kern <[EMAIL PROTECTED]> writes: > Pete Forman wrote: >> I'm trying to move the building of a zip file from a shell script into >> python. It is mostly working but when I unzip the files the UNIX >> permissions are not preserved. The zip program I've been using is the >> standard(?) one

Re: zipfile and file permissions

2006-01-20 Thread Robert Kern
Pete Forman wrote: > I'm trying to move the building of a zip file from a shell script into > python. It is mostly working but when I unzip the files the UNIX > permissions are not preserved. The zip program I've been using is the > standard(?) one on Linux, from Info-Zip. Presumably I need to d

zipfile and file permissions

2006-01-20 Thread Pete Forman
I'm trying to move the building of a zip file from a shell script into python. It is mostly working but when I unzip the files the UNIX permissions are not preserved. The zip program I've been using is the standard(?) one on Linux, from Info-Zip. Presumably I need to do something with external_a

Re: Getting TypeError in Changing file permissions

2005-07-22 Thread Peter Hansen
Benjamin Niemann wrote: > Pranav Bagora wrote: >>" os.chmod(outfile,0700) >>TypeError: coercing to Unicode: need string or buffer, >>file found" > > Looks as if your are using a file object (that you got from an open() call) > as the first parameter. What you need is a string with the path to the

Re: Getting TypeError in Changing file permissions

2005-07-22 Thread Jeff Epler
If you are using Unix, and all you have is the file object, you can use os.fchmod(outfile.fileno(), 0700) Jeff pgp8U05e26RUt.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting TypeError in Changing file permissions

2005-07-22 Thread Benjamin Niemann
Pranav Bagora wrote: > Hello , > i am trying to change mode of files using the > os.chmod()function. But i am getting an error > > " os.chmod(outfile,0700) > TypeError: coercing to Unicode: need string or buffer, > file found" Looks as if your are using a file object (that you got from an open()

Getting TypeError in Changing file permissions

2005-07-22 Thread Pranav Bagora
Hello , i am trying to change mode of files using the os.chmod()function. But i am getting an error " os.chmod(outfile,0700) TypeError: coercing to Unicode: need string or buffer, file found" Please Help, Pranav __ Do You Yahoo!? Tired of spam?

Re: file permissions on windows XP (home)

2005-06-08 Thread Ivan Van Laningham
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

Re: file permissions on windows XP (home)

2005-06-08 Thread gratzel
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

Re: file permissions on windows XP (home)

2005-06-08 Thread barney
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

Re: file permissions on windows XP (home)

2005-06-08 Thread Duncan Booth
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 m

Re: file permissions on windows XP (home)

2005-06-07 Thread barney
ectory but unchecking it there also has no lasting effect. 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

Re: file permissions on windows XP (home)

2005-06-07 Thread Duncan Booth
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

Re: file permissions on windows XP (home)

2005-06-07 Thread Peter Hansen
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

file permissions on windows XP (home)

2005-06-06 Thread barney
I'm trying to write to an existing file under windows XP (home). The files are in 'My Music' which I think may be treated in some special way under XP. The relevant python code is as follows: os.chdir(dir) os.chmod(filename, 0744) print "Okay to write = "+str(os.access(filename, os.W_OK)) afile =

Re: CGI, anydbm.open() and linux file permissions

2005-01-11 Thread Dan Sommers
On Tue, 11 Jan 2005 15:16:53 -0800 (PST), Derek Basch <[EMAIL PROTECTED]> wrote: > Hello, > I have a CGI script which uses anydb.open() to create a DBM. However I get > this > traceback: > /usr/lib/python2.3/bsddb/__init__.py in > hashopen(file='/var/www/bp/predictor/tools.dbm', flag='c', mode=

CGI, anydbm.open() and linux file permissions

2005-01-11 Thread Derek Basch
Hello, I have a CGI script which uses anydb.open() to create a DBM. However I get this traceback: /usr/lib/python2.3/bsddb/__init__.py in hashopen(file='/var/www/bp/predictor/tools.dbm', flag='c', mode=438, pgsize=None, ffactor=None, nelem=None, cachesize=None, lorder=None, hflags=0) 190 i