File permissions script vs shell

J

jdlists

I'm running python on windows and have a program that watches a
directory and acts on files as they come into the directory. After
processing is complete, i delete the file, or in this case attempt
to....

In the script version I repeatedly get OSError exceptions stating
permission denied when trying to delete or rename

My exception print out...
Files system said no: [Errno 13] Permission denied:
u'D:\\Data\\00-0C-41-DD-87-E5.xml'

But i can go into the python shell and execute...

fileString = 'D:\\Data\\00-0C-41-DD-87-E5.xml'
import os
os.unlink(fileString)

and the file deletes fine

Any ideas? This is on my development windows xp box and i'm the only
user.

Thanks
Jeff
 
F

Fredrik Lundh

I'm running python on windows and have a program that watches a
directory and acts on files as they come into the directory. After
processing is complete, i delete the file, or in this case attempt
to....

In the script version I repeatedly get OSError exceptions stating
permission denied when trying to delete or rename

My exception print out...
Files system said no: [Errno 13] Permission denied:
u'D:\\Data\\00-0C-41-DD-87-E5.xml'

But i can go into the python shell and execute...

fileString = 'D:\\Data\\00-0C-41-DD-87-E5.xml'
import os
os.unlink(fileString)

and the file deletes fine

Any ideas? This is on my development windows xp box and i'm the only
user.

did you close the file correctly after processing it ?
Traceback (most recent call last):
Traceback (most recent call last):

</F>
 
J

jdlists

Fredrik said:
I'm running python on windows and have a program that watches a
directory and acts on files as they come into the directory. After
processing is complete, i delete the file, or in this case attempt
to....

In the script version I repeatedly get OSError exceptions stating
permission denied when trying to delete or rename

My exception print out...
Files system said no: [Errno 13] Permission denied:
u'D:\\Data\\00-0C-41-DD-87-E5.xml'

But i can go into the python shell and execute...

fileString = 'D:\\Data\\00-0C-41-DD-87-E5.xml'
import os
os.unlink(fileString)

and the file deletes fine

Any ideas? This is on my development windows xp box and i'm the only
user.

did you close the file correctly after processing it ?
Traceback (most recent call last):
Traceback (most recent call last):

</F>

That was correct...i started to see it just after posting, the open
file was hidden behind the 4Suite library via the FromUri method.
Reading the xml file as a string and passing it to fromString instead
and closing the file myself solved this.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top