473,326 Members | 2,013 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,326 software developers and data experts.

which command i should use to get write permission for file

cs = open(r"session1.txt", "a+")
cs.write(i)




cs undefined, builtin open = <type 'file'>

IOError: [Errno 13] Permission denied: 'session1.txt'
args = (13, 'Permission denied')
errno = 13
filename = 'session1.txt'
strerror = 'Permission denied'
Mar 25 '07 #1
3 5681
bartonc
6,596 Expert 4TB
cs = open(r"session1.txt", "a+")
cs.write(i)




cs undefined, builtin open = <type 'file'>

IOError: [Errno 13] Permission denied: 'session1.txt'
args = (13, 'Permission denied')
errno = 13
filename = 'session1.txt'
strerror = 'Permission denied'
"
>>> help(open)
Help on class file in module __builtin__:

class file(object)
| file(name[, mode[, buffering]]) -> file object
|
| Open a file. The mode can be 'r', 'w' or 'a' for reading (default),
| writing or appending. The file will be created if it doesn't exist
| when opened for writing or appending; it will be truncated when
| opened for writing. Add a 'b' to the mode for binary files.
| Add a '+' to the mode to allow simultaneous reading and writing.
| If the buffering argument is given, 0 means unbuffered, 1 means line
| buffered, and larger numbers specify the buffer size.
| Add a 'U' to mode to open the file for input with universal newline
| support. Any line ending in the input file will be seen as a '\n'
| in Python. Also, a file so opened gains the attribute 'newlines';
| the value for this attribute is one of None (no newline read yet),
| '\r', '\n', '\r\n' or a tuple containing all the newline types seen.
|
| 'U' cannot be combined with 'w' or '+' mode.
|
| Note: open() is an alias for file()."

That last part is very pertainate to you situation.
Mar 25 '07 #2
ghostdog74
511 Expert 256MB
cs = open(r"session1.txt", "a+")
cs.write(i)




cs undefined, builtin open = <type 'file'>

IOError: [Errno 13] Permission denied: 'session1.txt'
args = (13, 'Permission denied')
errno = 13
filename = 'session1.txt'
strerror = 'Permission denied'
is session1.txt a new file that hasn't been created? of has it been created and some other processes are using it? another possibility is the current user running the script does not have permission to write to this file. check the permission for this file or ask the administrator.
Mar 26 '07 #3
os.chmod(...)
Change the access permissions of a file.
Mar 27 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mark Szlazak | last post by:
All files that I will be referring to are in the same file folder. I need my javascipt file to write or save the contents of a textarea to other local files. This is for local use only on one...
2
by: ykgoh | last post by:
Hi. I've a problem of being able to create and remove a directory but unable to write a file inside the created directory for some strange reason. I suspect that this problem could be vaguely...
4
by: Jon Asher | last post by:
Hi, I'm trying to do a simple import of a comma delimited text file with COPY but it's returning an error. The file has been granted all permissions in Linux, so it's not clear to me what the...
4
by: Phil | last post by:
I've made a command line app. two in fact. one in dotnet and the other vb6 to see if that made a dif. The commandline app writes to a file. this works fine when I run it from windows. If I run it...
3
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images ...
2
by: James | last post by:
Hi all, I am new to ASP.NET. I am currently working on a project with VB, .NET 1.1 on a Windows 2000 server. I have two files C:\Inetpub\wwwroot\test\test.aspx...
3
by: nihad.nasim | last post by:
Hi, I am kind of new to PHP and while learning I came across the touch command which creates a new file. I also came up with fopen to open a file. In both cases I am having the same problem: ...
1
by: Selvakumar | last post by:
hai friends, I am new to .net programming. I did the inserting data into MS-access database but i couldn't able to perform the update command. I used only textbox and command button for inserting...
5
by: downwitch | last post by:
I have the strangest error, and wonder if anyone else has seen it. I'm using ADODB to return a set of SQL Server 2005 records via ODBC. If I open the recordset this way With cmd .CommandType =...
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: 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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.