Uri
Uri

Reputation: 26966

can python write to file while file is open in notepad?

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?

Upvotes: 0

Views: 563

Answers (3)

David
David

Reputation: 5016

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.

Upvotes: 1

Demian Brecht
Demian Brecht

Reputation: 21368

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.

Upvotes: 1

Related Questions