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! 0 3978 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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
|
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
|
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...
|
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
|
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:
| |
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 ?
|
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:...
|
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:
|
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:
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |