473,801 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

os.remove OSError: [Errno 13] Permission denied

Please put me in CC

When running the following program I get frequent errors like this one

Exception in thread Thread-4:
Traceback (most recent call last):
File "C:\Python24\li b\threading.py" , line 442, in __bootstrap
self.run()
File "os.remove. py", line 25, in run
os.remove(filen ame)
OSError: [Errno 13] Permission denied:
'c:\\docume~1\\ joag\\locals~1\ \temp\\tmpx91tk x'

When leaving out the touch statement(line 24) in the loop of the class,
I do not get any errors.
This is on Windows XP SP2 with python-2.4.2 (you should have an exe
touch somewhere in you path for this to work)
Can somebody shed any light on this please?

Thanks in advance

Joram Agten
import os
import tempfile
import threading
import subprocess

def touch(filename) :
output = str()
process = subprocess.Pope n("touch " + filename ,
stdin=None,
stdout=subproce ss.PIPE, stderr=subproce ss.STDOUT,
universal_newli nes=True)
process.wait()

class this(threading. Thread):
def __init__(self):
threading.Threa d.__init__(self )
self.start()

def run(self):
for i in range(0, 100):
filename = tempfile.mktemp ()
f = open(filename, 'w')
f.write("test")
f.close()
touch(filename)
os.remove(filen ame)

getters = []
for i in range(0, 10):
getter = this()
getters.append( getter)

for getter in getters:
getter.join()

Visit Telindus Access Products at Cebit 2006, Hall 13, Booth 34, 9-15 March 2006.
Discover Telindus' range of access & surveillance products in a live "voice and video over DSL" demo and collect the new catalogue 2006-2007. See you in Hannover!
Feb 1 '06 #1
0 3978

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

Similar topics

0
1129
by: John J. Lee | last post by:
Today, I wanted to do something like this: def nr_files(dirName) try: return len(os.listdir(dirName)) except OSError, e: if e.errno == errno.ENOENT: return 0 else: raise
1
8261
by: Mark Harrison | last post by:
Can somebody loan me a clue as to how to check the errno on an OSError, as described below? try: os.makedirs(d) except OSError: # if errno == 17 then silently ignore the error because the # other process won the race condition and created the directory # otherwise, allow the exception to percolate up the call stack # and be caught by the standard error reporter
11
7875
by: Alec Wysoker | last post by:
Using Python 2.3.5 on Windows XP, I occasionally get OSError: Permission denied when calling os.remove(). This can occur with a file that is not used by any other process on the machine, and is created by the python.exe invocation that is trying to delete it. It can happen with various pieces of my system - almost anywhere I try to delete a file. I have assumed that the problem is that I was holding on to a handle to the file that I...
10
5786
by: k r fry | last post by:
Hi, I am new to this list and also programming with python. I have an error: oserror not a directory "katiescint.py" The piece of code causing the problem is: for subdir in os.listdir(DATADIR): #loop through list of strings
4
10317
by: David Hirschfield | last post by:
I know this should be obvious, but how does one raise a specific type of OSError? When I attempt to perform a file operation on a non-existent file, I get an OSError: , but what if I want to raise one of those myself? Thanks in advance, -Dave -- Presenting:
0
1954
by: robert | last post by:
e.g. open/os module functions (os.path.getmtime...) and win32api/win32file functions fail on long paths (>~255 chars) even the '\\?\' trick from http://www.google.com/url?sa=D&q=http://msdn.microsoft.com/library/default.asp%3Furl%3D/library/en-us/fileio/fs/naming_a_file.asp does not work: >>> os.path.getmtime('\\\\?\\'+fabs) Traceback (most recent call last): File "<interactive input>", line 1, in ?
0
3207
by: debug03 | last post by:
I am executing a DTS package on a Windows 2000 sp4 server running SQL Server 2000 and IBM DB2 V7 client. The DTS package source data(SQL Server) is selected from SQL server table and inserts data to the destination table(DB2). I get the following error when the package is executed: The execution of the following DTS Package succeeded: Package Name: PEX2-CopyQualDatatoDB2-UAT Package Description: (null) Package ID:...
2
7580
by: Michael George Lerner | last post by:
Hi, (Python 2.5, OS X 10.4.10) I have a program called pdb2pqr on my system. It is installed so that "pdb2pqr" is in my path and looks like: #\!/bin/zsh -f /sw/share/pdb2pqr/pdb2pqr.py "$@" When I call it via this script:
61
3296
by: arnuld | last post by:
I have created a program which creates and renames files. I have described everything in comments. All I have is the cod-duplication. function like fopen, sprint and fwrite are being called again and again. I know to remove code-duplication I have to make functions and pass arguments to them but I am not able to think of a way doing it. Can you post some example for me, out of this code:
0
9698
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9556
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
10292
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...
0
10052
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
9101
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7589
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2959
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.