0

I'm using csv.writer to write to file. Is it okay if the file is open in notepad at the same time?

What about programs other than notepad?

1
  • 1
    Depends on the program. And the OS.
    – Josh Lee
    Apr 20, 2011 at 19:33

3 Answers 3

3

Notepad does not create explicit lock for open files.

http://social.technet.microsoft.com/Forums/en/windowsserver2008r2branchoffice/thread/2d844400-66e3-4c94-9369-902056064f20

http://en.wikipedia.org/wiki/File_locking

1

As long as the application doesn't have a file lock on the file in question, then sure it's fine.

Having said that, if the user then edits the file in notepad after and saves it, it will stomp your edits. Most editors (i.e. Notepad++) will catch edited files and ask you whether or not you want to reload them, Notepad isn't one of them.

1

Notepad should be alright, as I do not believe it places a lock on the file. If it however is open in Microsoft Excel, a lock is placed on the file, so you cannot write to it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.