467,910 Members | 1,661 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,910 developers. It's quick & easy.

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\lib\threading.py", line 442, in __bootstrap
self.run()
File "os.remove.py", line 25, in run
os.remove(filename)
OSError: [Errno 13] Permission denied:
'c:\\docume~1\\joag\\locals~1\\temp\\tmpx91tkx'

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.Popen("touch " + filename ,
stdin=None,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
universal_newlines=True)
process.wait()

class this(threading.Thread):
def __init__(self):
threading.Thread.__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(filename)

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
  • viewed: 3396
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Mark Harrison | last post: by
10 posts views Thread by k r fry | last post: by
4 posts views Thread by David Hirschfield | last post: by
61 posts views Thread by arnuld | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.