473,472 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Help Needed. Removing a Folder Problem

When I push a button to trigger the code:

def runCCCC(self, event):
cmd_out = self.A_com()
if App.runF != "":
os.mkdir('C:\copiedFiles')

for item in App.runF:
App.beCopied = str(item)
shutil.copy(App.beCopied,
'C:\copiedFiles')
cmd = 'cccc C:\copiedFiles\*.*' + cmd_out
os.system(cmd)
shutil.rmtree('C:\copiedFiles')
else:
tkMessageBox.showinfo("Window Text",
"Please Firstly Browse and Insert A File")
I encountered this error:

Traceback (most recent call last):
File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345,
in __call__
return self.func(*args)
File "C:\Python24\TkScripts\RCFolder.py", line 61,
in runCCCC
shutil.rmtree('C:\copiedFiles',
ignore_errors=False)# OLMADI!!!
File "C:\Python24\lib\shutil.py", line 168, in
rmtree
onerror(os.remove, fullname, sys.exc_info())
File "C:\Python24\lib\shutil.py", line 166, in
rmtree
os.remove(fullname)
OSError: [Errno 13] Permission denied:
'C:\\copiedFiles\\Analog.c'

1. What I want to do is to get the list of files I
inserted to a Listbox,
2. Creating a folder,(C:\copiedFiles)
3. Copying all of these files to this folder with the
same names,
4. Running CCCC for all of the files in this folder,
5. Than removing this folder.

Can anyone enlighten me on this Error I have got and
how to solve it?

Regards
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Jul 20 '06 #1
3 3830
Note the error is permission denied. I would guess that
either the file has read-only flag set or perhaps the
'cccc' program is still running and has the file open
in a separate thread so you can't delete the directory
until it has completed. You should take a look at the
subprocess module and use something like (not tested):

retcode = call([r'cccc C:\copiedfiles\*.*', cmd_out])

This will wait for execution of cccc to complete prior
to returning.

-Larry Bates
Kilicaslan Fatih wrote:
When I push a button to trigger the code:

def runCCCC(self, event):
cmd_out = self.A_com()
if App.runF != "":
os.mkdir('C:\copiedFiles')

for item in App.runF:
App.beCopied = str(item)
shutil.copy(App.beCopied,
'C:\copiedFiles')
cmd = 'cccc C:\copiedFiles\*.*' + cmd_out
os.system(cmd)
shutil.rmtree('C:\copiedFiles')
else:
tkMessageBox.showinfo("Window Text",
"Please Firstly Browse and Insert A File")
I encountered this error:

Traceback (most recent call last):
File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345,
in __call__
return self.func(*args)
File "C:\Python24\TkScripts\RCFolder.py", line 61,
in runCCCC
shutil.rmtree('C:\copiedFiles',
ignore_errors=False)# OLMADI!!!
File "C:\Python24\lib\shutil.py", line 168, in
rmtree
onerror(os.remove, fullname, sys.exc_info())
File "C:\Python24\lib\shutil.py", line 166, in
rmtree
os.remove(fullname)
OSError: [Errno 13] Permission denied:
'C:\\copiedFiles\\Analog.c'

1. What I want to do is to get the list of files I
inserted to a Listbox,
2. Creating a folder,(C:\copiedFiles)
3. Copying all of these files to this folder with the
same names,
4. Running CCCC for all of the files in this folder,
5. Than removing this folder.

Can anyone enlighten me on this Error I have got and
how to solve it?

Regards
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Jul 20 '06 #2
Note the error is permission denied. I would guess that
either the file has read-only flag set or perhaps the
'cccc' program is still running and has the file open
in a separate thread so you can't delete the directory
until it has completed. You should take a look at the
subprocess module and use something like (not tested):

retcode = call([r'cccc C:\copiedfiles\*.*', cmd_out])

This will wait for execution of cccc to complete prior
to returning.

-Larry Bates
Kilicaslan Fatih wrote:
When I push a button to trigger the code:

def runCCCC(self, event):
cmd_out = self.A_com()
if App.runF != "":
os.mkdir('C:\copiedFiles')

for item in App.runF:
App.beCopied = str(item)
shutil.copy(App.beCopied,
'C:\copiedFiles')
cmd = 'cccc C:\copiedFiles\*.*' + cmd_out
os.system(cmd)
shutil.rmtree('C:\copiedFiles')
else:
tkMessageBox.showinfo("Window Text",
"Please Firstly Browse and Insert A File")
I encountered this error:

Traceback (most recent call last):
File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345,
in __call__
return self.func(*args)
File "C:\Python24\TkScripts\RCFolder.py", line 61,
in runCCCC
shutil.rmtree('C:\copiedFiles',
ignore_errors=False)# OLMADI!!!
File "C:\Python24\lib\shutil.py", line 168, in
rmtree
onerror(os.remove, fullname, sys.exc_info())
File "C:\Python24\lib\shutil.py", line 166, in
rmtree
os.remove(fullname)
OSError: [Errno 13] Permission denied:
'C:\\copiedFiles\\Analog.c'

1. What I want to do is to get the list of files I
inserted to a Listbox,
2. Creating a folder,(C:\copiedFiles)
3. Copying all of these files to this folder with the
same names,
4. Running CCCC for all of the files in this folder,
5. Than removing this folder.

Can anyone enlighten me on this Error I have got and
how to solve it?

Regards
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Jul 20 '06 #3
Kilicaslan Fatih wrote:
[...]
Dear All,

I changed the mode of the files before copying them.
So the problem is solved as follows:

SOLUTION:

def runCCCC(self, event):
cmd_out = self.A_com()
if App.runF != "":
os.mkdir('C:\copiedFiles')

for item in App.runF:
os.chmod(item, 0700)
shutil.copy(item, 'C:\copiedFiles')

cmd = 'cccc C:\copiedFiles\*.*' + cmd_out
os.system(cmd)
for root,dir,files in
os.walk("C:\copiedFiles"):

shutil.rmtree('C:\copiedFiles')
else:
tkMessageBox.showinfo("Window Text",
"Please Firstly Browse and Insert A File")
Just be careful with those string constants: you should really be using
either 'C:\\copiedFiles' or r'C:\copiedFiles'. No problems at the moment
because "\c" isn't a defined escape sequence, but if your directory name
had begun with a "t", for example, you'd have got a tab after the colon.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

Jul 20 '06 #4

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

Similar topics

19
by: Thue Tuxen Sørensen | last post by:
Hi everybody ! I´m maintaining a large intranet (approx 10000 concurrent users) running on one IIS box and one DB box with sqlserver 2000. Currently there is 2,5 GB Ram, 1 1400 mhz cpu and 2...
67
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. ...
11
by: ricolee99 | last post by:
Hi everyone, I'm trying to invoke my .exe application from a remote server. Here is the code: ManagementClass processClass = new ManagementClass ("\\\\" +"RemoteServerName" +...
20
by: RWC | last post by:
Hi Folks, I have a windows 2000 server installation, IIS is running and the ASP.NET 1.1 SDK has been installed. I'm reading a book on ASP.NET and the lessons call for the first line to read <%@...
13
by: Siegfried Heintze | last post by:
I refered the engineer at my hosting service to http://support.microsoft.com/default.aspx?scid=kb;en-us;825738 where he tried to follow the directions there. He said there was no such file:...
2
by: techi_C | last post by:
Hi I'm getting a problem while removing semaphore from system. Before removing semaphore I'm checking the usage count of a smaphore. // checking usage count usage_count =...
5
by: Saabster | last post by:
Hi all, I'm fairly new to VB.NET but have more experience with VB6 and earlier. I'm trying to create an application that will move files from one folder to another. Here is the scenario. I...
3
by: =?Utf-8?B?SlA=?= | last post by:
<asp:GridView ID="gridResults" runat="server" AutoGenerateColumns="False" Width="98%" PageSize="25" AllowPaging="True" OnSorting="gridResults_Sorting" OnPageIndexChanging...
32
by: =?Utf-8?B?U2l2?= | last post by:
I have a form that I programmatically generate some check boxes and labels on. Later on when I want to draw the form with different data I want to clear the previously created items and then put...
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...
0
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,...
0
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,...
0
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...
1
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...
0
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...
0
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...
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.