Detect if specific Python.app instance is already running

Ned Deily nad at acm.org
Sun Jun 7 19:07:46 EDT 2015


In article <11e093d5-b78e-4ac6-9a7f-649cb2c2c942 at googlegroups.com>,
 Andrei <andrei.fokau at gmail.com> wrote:
> Alright, I have had some development in 
> http://stackoverflow.com/questions/30694560/detect-if-specific-python-app-inst
> ance-is-already-running and can prevent running multiple instances of the 
> same app/script (by lockf), but I still need to identify which Python.app 
> instance is running certain script. I guess it's more Cocoa-related question 
> but I hope someone had same problem with tkinter etc.

Can you give a more complete explanation of the goal, i.e. what you are 
trying to end up with here, rather than the steps you are taking to get 
there?  It's not at all clear to me what your goal is and the cumbersome 
steps you find you have to take suggest that you might be going down the 
wrong path.  OS X apps usually don't have to resort to such hacks.  If 
you haven't already, make sure you have looked at the "Information 
Property List Key Reference" for OS X (and iOS) apps.  For instance, key 
LSMultipleInstancesProhibited *might* be useful if you really only want 
to ensure that there is only instance of an app launched.

https://developer.apple.com/library/mac/documentation/General/Reference/I
nfoPlistKeyReference/Articles/LaunchServicesKeys.html

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list