472,353 Members | 1,292 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Re: I/O error 13 Permission denied -Cannot access file as it is usedby another process.

aditya shukla wrote:
Hello folks,

I am creating a python script[windows vista and python2.5] which
accesses another program(prog2).I my python script i am creating a
temporary file and i write the output of prog2
in this temporary file.

temp =
tempfile.NamedTemporaryFile(suffix='_suffix',prefi x='prefix_',dir='C:\\Python25')
- #this how create the temporary file ( i am not closing the temporary
file).This works fine
Why on earth are you *specifying* c:\python25 as the
directory for this file? It's automatically created
in your user-specific temp directory which has specific
permissions and is (obviously) specific to that user.
You may -- depending on your needs -- also not need the
suffix & prefix.

ie, unless you have some specific need in mind, just use:

temp = tempfile.NamedTemporaryFile ()
x= os.path.split(tn)

y=x[1]

Now i search for the file and then try to read this file so that i can
perform some calculations.

This step causes the problem
file=open(find_file,"rb") # find_file is the object returned after
searching the file

error mesage:

the process cannot access the file as another process because it is
being used by another program.(prog2 in this case)
i/o error 13 permission denied

The main stumbling block here is that you're not posting
code you're running, but fragments of code which may or
may not exist in your source. What is tn? What have x
and y to do with anything? What is find_file? And so on.

As far as I can tell you're trying to create a temporary
file, pass its name to another process which writes to
it. You then, in the first process, read the results of
the second process. Is that right?

At the very least, please cut-and-paste a session from
the console which is running the program so that the traceback
is clear.

Thanks
TJG
Aug 28 '08 #1
0 1749

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

Similar topics

3
by: Colin Graham | last post by:
I am working with a piece of javascript that i have inherited from another developer. It is for a date picker function and it runs fine locally but...
2
by: nospam | last post by:
Hi, How can I have more than one argument in this statement? Adding a second one gets an error. Process myProcess =...
6
by: karim | last post by:
I have an asp.net page that stopped running properly giving the error below. The app uses a SQL Server 2000 on another server. Enterprise Manager...
2
by: james | last post by:
Not sure if this is the right group, but anyway. I've built a setup project in vs2005 to install my program. All works fine, until I issue an...
4
by: chaz | last post by:
here is the html : <br> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="<%=LABEL_WIDTH%>" class="formtext"><%=...
6
by: scottrm | last post by:
Hi Users seem to be getting the following intermitent error whe they post a form. Validation of viewstate MAC failed. If this application is...
1
by: Praveen | last post by:
I have configured the system database backup using SQL Server 2005 Maintenance Plan. It was running properly quite some time with in 5 to 10...
2
by: FutureShock | last post by:
I am using a registration class to process a registration form and need some opinions on returning error messages. I am self referring the page...
2
by: sarabonn | last post by:
hello everyone, I have created a setup using setup and deployment project using visual c# 2008. It's is a windows Form...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.