[issue3455] os.remove()method document error

香槟酒 report at bugs.python.org
Mon Jul 28 15:35:37 CEST 2008


香槟酒 <zkfarmer at gmail.com> added the comment:

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 at bugs.python.org>

>
> Facundo Batista <facundo at 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
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue3455>
> _______________________________________
>

Added file: http://bugs.python.org/file10994/unnamed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3455>
_______________________________________
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: unnamed
URL: <http://mail.python.org/pipermail/python-bugs-list/attachments/20080728/e121a43c/attachment-0001.txt>


More information about the Python-bugs-list mailing list