S
Stéphane Ninin
Hello world,
I am fighting with what is probably a stupid problem.
In a wxpython GUI, here is a method which must read a file,
and if the file is not correctly formed rename it and create a new file:
(I have removed most of the logic of the code here, so I am not sure
it's going to be helpful)
def makeTree(self):
print 'HERE WE ARE'
f = file(self.__filename,'r')
f.close()
from shutil import move
from os.path import join
bakname = self.__filename + '.bak'
print bakname
print f.closed
f.close()
print 'TEST',f.closed
move(self.__filename,bakname)
Here is some of the output corresponding to this method
(on cygwin/Windows 2000, with python 2.3.3):
.... in makeTree:
move(self.__filename,bakname)
File "e:\Program\Python\lib\shutil.py", line 171, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: u'C:\\home\\natasha\\stephane\\PYTHON
\\Projects\\Scripts\\config.xml'
python -V
Python 2.3.3
I just do not understand what could cause this "permissions denied" for this
file. Any idea of what stupid thing I could have done somewhere in the code
that could cause that ?
Thanks in advance for any suggestion...
Regards,
I am fighting with what is probably a stupid problem.
In a wxpython GUI, here is a method which must read a file,
and if the file is not correctly formed rename it and create a new file:
(I have removed most of the logic of the code here, so I am not sure
it's going to be helpful)
def makeTree(self):
print 'HERE WE ARE'
f = file(self.__filename,'r')
f.close()
from shutil import move
from os.path import join
bakname = self.__filename + '.bak'
print bakname
print f.closed
f.close()
print 'TEST',f.closed
move(self.__filename,bakname)
Here is some of the output corresponding to this method
(on cygwin/Windows 2000, with python 2.3.3):
.... in makeTree:
move(self.__filename,bakname)
File "e:\Program\Python\lib\shutil.py", line 171, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: u'C:\\home\\natasha\\stephane\\PYTHON
\\Projects\\Scripts\\config.xml'
python -V
Python 2.3.3
I just do not understand what could cause this "permissions denied" for this
file. Any idea of what stupid thing I could have done somewhere in the code
that could cause that ?
Thanks in advance for any suggestion...
Regards,