Hello everyone!
I am using python 2.6 on cygwin environment and wondering how could i prevent two python processes from writing to a file at the same time.
The file that is shared between the python processes is an ini file and is accessed through ConfigObj module.
The first python process is a daemon which runs indefinitely writing to the ini file, data on some random external conditions.
The other python processes, start occasionally (one at a time), execute their code, write data on the ini file and stop.
The command i want to ensure that is safely executed in all scripts is the :
config.write()
with config being the object that is created by the ConfigObj library :
config = ConfigObj('myfile.ini')
Testing the above, didn't produce any errors but, i can never be sure that way...
So, is there any way to do it without rewriting all my code?(Without using threads for example)
P.S. I will probably sooner or later change platform from cygwin to linux, so if there is a solution not applied in cygwin but linux compatible, i will not exlude it.
Thanks in advance.