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: 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() call)

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 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 file.