Python Forum
Saving the times a script is run to a file or ...
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Saving the times a script is run to a file or ...
#5
(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.
Reply


Messages In This Thread
RE: Saving the times a script is run to a file or ... - by ibreeden - Oct-19-2022, 07:36 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Music Python Script Repeating Number When Saving Facebook Photos ThuanyPK 2 240 May-13-2024, 10:59 PM
Last Post: ebn852_pan
  Code Assistance needed in saving the file MithunT 0 874 Oct-09-2022, 03:50 PM
Last Post: MithunT
  Saving the print result in a text file Calli 8 2,015 Sep-25-2022, 06:38 PM
Last Post: snippsat
  Trying to determine attachment file type before saving off.. cubangt 1 2,279 Feb-23-2022, 07:45 PM
Last Post: cubangt
  Showing and saving the output of a python file run through bash Rim 3 2,631 Oct-06-2021, 10:48 AM
Last Post: gerpark
  Problem in saving .xlsm (excel) file using pandas dataframe in python shantanu97 2 4,541 Aug-29-2021, 12:39 PM
Last Post: snippsat
  Need help with saving output into an excel file Beyondfacts 4 3,068 Mar-22-2021, 11:51 AM
Last Post: jefsummers
  Automating to run python script 100 times by changing parameters pmt 1 2,676 Dec-29-2020, 10:31 AM
Last Post: andydoc
  Saving text file with a click: valueerror i/o operation on closed file vizier87 5 4,574 Nov-16-2020, 07:56 AM
Last Post: Gribouillis
  Copy mp3 file multiple times and rename Mar10 4 3,888 Sep-23-2020, 01:09 AM
Last Post: Mar10

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020