I need to find a right way to prevent two running instances of my (Python) program. I am currently using the following method.
On Windows,
os.popen(\
For linux, see the answer from jldupont. For windows, use the CreateMutex-method, to create a named mutex. See: http://msdn.microsoft.com/en-us/library/ms686927%28VS.85%29.aspx