I am trying to find an elegant way to exchange a variable between an application form window and a python script running in the background. This variable will only be used to update the progress bar in the form of a window based on a long running process on a python script. More specifically, a Windows timer starts n every second , checks for a variable, and then updates the progress bar. Is the sound dumb enough? I will try to explain the need for this below.
I have a Windows application that allows the user to define several parameters in order to bring down a lengthy process (python script). Without going into unnecessary details, this long-term process for a considerable period of time inserts a lot (100k + records) into the sqlite database. To make the python script as possible as possible, I don't call commit in the sqlite database until the very end of the python script. Trying to query the sqlite database from a Windows application (via System.Data.Sqlite) before committing always yields 0 records, regardless of how far the process has come.
A Windows application will know how many records will be inserted by the python process, so determining progress will be quite simple, assuming that I can access the record count in a python script.
I know I can do this with a text file, but is there a better way?
source
share