file locked for writing
Dmitry Teslenko
dteslenko at gmail.com
Wed May 14 03:04:19 EDT 2008
On Wed, May 14, 2008 at 8:18 AM, Gabriel Genellina
<gagsl-py2 at yahoo.com.ar> wrote:
> En Tue, 13 May 2008 11:57:03 -0300, Dmitry Teslenko <dteslenko at gmail.com>
> Is the code above contained in a function? So all references are released
> upon function exit?
Yes, it's a function
> If not, you could try using: del input, output, filter
> That should release all remaining references to the output file, I presume.
> Or locate the inner reference to the output file (filter.something perhaps?)
> and explicitely close it.
That doesn't help either.
When I've rewrite code something like that:
with open(backup_file_name, 'w') as backup_file:
.....
filter.parse('<updated file name>')
del input, output, filter
os.remove(project.get_vcproj())
os.rename(backup_file_name, project.get_vcproj())
It triggers WindowsError on os.remove()
More information about the Python-list
mailing list