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
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
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
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
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
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
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
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() 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
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
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
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
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
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
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
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
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
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:
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
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
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"
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'
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
> 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
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
> 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
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
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
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)
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
> 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")
!
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
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
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 "",
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
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
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
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
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
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
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
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()
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?
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 m
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
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
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 =
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=
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
59 matches
Mail list logo