473,378 Members | 1,378 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,378 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 1824

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 i get an error when i deploy it on the server and...
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 = Process.Start("ABC.exe", "arg1");
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 and Query analyzer on the web server can connect to...
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 update. If anyone tries to install it, they get the...
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"><%= HTEXT("Connection type:")%></td> <td...
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 hosted by a Web Farm or cluster, ensure that...
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 minutes. Suddenly I am getting this error "Process is...
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 on submit. I would like to send each form field...
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 application. I made some changes to the setup in...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.