Oct-19-2022, 07:36 AM
(Oct-18-2022, 04:26 PM)3Pinter Wrote: Unsure how to test the 'same time' two scripts wanting to write something in the text (or csv) file.First: if you are planning to have the csv file on a share, then test it on that share.
Create two scripts:
First script:
import time myfile = r"\\myserver\myshare\myfolder\testbestand.txt" testbestand = open(myfile, "a") print("This is the first script", file=testbestand) time.sleep(60) print("First script closes file", file=testbestand) testbestand.close()Second script:
myfile = r"\\myserver\myshare\myfolder\testbestand.txt" testbestand = open(myfile, "a") print("This is the second script", file=testbestand) testbestand.close()Start the first script. It will run one minute. Within this minute start the second script. Does it give an error? What are the contents after both scripts have run? And what happens if you start the two scripts from different computers?
I can't test this myself because I don't have Windows.