How to avoid multiple instances of a program?

前端 未结 3 501
没有蜡笔的小新
没有蜡笔的小新 2021-01-02 11:19

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(\         


        
3条回答
  •  甜味超标
    2021-01-02 11:47

    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

提交回复
热议问题