473,322 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Getting TypeError in Changing file permissions

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? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Jul 22 '05 #1
2 2449
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)
as the first parameter. What you need is a string with the path to the
file.

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Jul 22 '05 #2
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.


Which this should do:

os.chmod(outfile.name, 0700)

-Peter
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: LRW | last post by:
Sorry to crosspost, but I have no idea if this is more a PHP question of general Linux question. I have a script that makes changes to image files, montages them into a jpg, and creates a Web...
7
by: ‘5ÛHH575-UAZWKVVP-7H2H48V3 | last post by:
(see end of message for example code) When an instance has a dynamically assigned instance method, deepcopy throws a TypeError with the message "TypeError: instancemethod expected at least 2...
4
by: projecktzero | last post by:
Well, I've managed to get an image into a postgre database, but now I'm having trouble getting it out. #! /usr/bin/env python from pyPgSQL import PgSQL def main(): connectdb =...
2
by: Jozef | last post by:
Hello, Is there a way to change table permissions in VB Code? I can't seem to find much that's concise in the help file. Here's the situation; I have a table in the "data" portion of a split...
0
by: Isabelle | last post by:
Hi I have posted this in the microsoft.public.frontpage newsgroups. Since it involves both Frontpage ext. 2002 on a windows 2000 Advanced's web server, and ASP.Net (framework 1.0), I decided to...
2
by: \ | last post by:
Problem is something like this. Some web applications written in php change permissions of some files and directories so I can't remove them if I don't change permissions to write those files and...
1
by: Paul Du Bois | last post by:
Using win32 python 2.4.1, I have a minimal test program: def generate(): raise TypeError('blah') yield "" print "\n".join((generate())) Executing the program gives:
7
by: Girish Sahani | last post by:
Hi, Please check out the following loop,here indexList1 and indexList2 are a list of numbers. for index1 in indexList1: for index2 in indexList2: if ti1 == ti2 and not index1 !=...
10
by: est | last post by:
>>import md5 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python25\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.