Thank you for your reply.I mean I used gvim to open a file. the Python manual did not specify how to use a file, but said that if
a file is to be used, the deletion of the file will be exception to be raise.so when I use gvim to open a file, then run os.remove () method to
remove the file, the file is deleted, and no exception to be raise.
2008/7/28 Facundo Batista
<report@bugs.python.org>
Facundo Batista <facundo@taniquetil.com.ar> added the comment:
zkfarmer, please try the following from your IDLE:
>>> myfilename = r"c:\tmp\test.txt"
>>> fh = open(myfilename, "w")
>>> fh.write("test\n")
>>> fh.close()
>>> fh = open(myfilename)
>>> import os
>>> os.remove(myfilename)
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
os.remove(myfilename)
WindowsError: [Error 32] The process cannot access the file because it
is being used by another process: 'c:\\tmp\\test.txt'
>>>
...and copy here what happened.
Thanks!
----------
nosy: +facundobatista