473,734 Members | 6,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.NamedT emporaryFile(su ffix='_suffix', prefix='prefix_ ',dir='C:\\Pyth on25')
- #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.NamedT emporaryFile ()
x= os.path.split(t n)

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 1851

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

Similar topics

3
3554
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 run it. Can anyone help me with my issue i get a permission denied error also when the error begins. i get the error on the folowing part of the codee: window.opener.Form1.txtDate.value = '05/10/2004' The complete line of code is
2
1274
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
4497
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 that sql server just fine and run queries. I rebooted the web server and made aspnet member of the admin group. I don't know why the error mentions open connections if I can open several query anaylzer windows using the same sql server...
2
5074
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 error "Another version of this product is already installed". They then need to go to Add/Remove programs to uninstall before trying again. I did find a workaround of changing the product code in my setup project, and then they can install it, but...
4
4893
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 class="formtext"> <input type="radio" class="inputRadio" id="dbStatus" name="dbStatus" value="1" onclick="changeDbStatus(1)" <%if dbStatus=1 then%checked
6
6258
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 <machineKeyconfiguration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
1
2771
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 terminated due to StackOverflowException. The return value was unknown. The process exit code was -2147023895". And the back up did not complete for 55 minutes and finally it got failed. Somebody good help me out pls. rgs Praveen
2
1872
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 to the class for processing (validating, sanitizing, etc..) So far no problem. Now I am throwing ideas around on how best to check for error messages to the users.
2
1273
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 visual c# and tried to install it again i got a error "another version of the project is installed". how can i get rid of this ?.. Thank you.. Dinesh.
0
8783
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9321
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9248
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9193
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6043
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4819
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3268
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.