in reply to Unable to write to a file opened in read only mode

This is just how NT is, in my experience. Try running your script on a non-Windows OS (UNIX) and see if the behavior is more to your liking.
  • Comment on Re: Unable to write to a file opened in read only mode