[Tutor] Can't edit a file I've opened with open(), then closed with close()
Richard D. Moores
rdmoores at gmail.com
Mon Sep 12 07:29:30 CEST 2011
Win 7, Python 3.2.1
I'm trying to improve my skills with opening text files, reading from them,
and writing to them.
But while I'm doing this sometimes I want to manually modify the text file
I'm using, C:\t\text.txt . Say I've done this:
>>> f = open(r"C:\t\test.txt", 'r+')
the time for all goo men\nto come to the aid\nof their party.\n'
and I decide to manually delete all those integers, and also correct "goo".
So I open test.txt and do that. But when I try to save, I get "The process
cannot access the file because it is being used by another process." I'm
using IDLE, so I close it. But still no save. Why? And what can I do about
it? I check with the task manager and see 22 pythonw.exe processes..
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor