Hello,

I am experimenting with OS X apps written in Python and need to detect if there 
is already an instance of Python.app running with certain script. My script 
modifies CFBundleName on-the-fly from "Python" to "MyApp" to change the app 
title in the menubar. If I start another instance and check CFBundleName of the 
running apps, it will only tell me the original value, i.e. "Python":

for app in NSWorkspace.sharedWorkspace().runningApplications():
    bundle = NSBundle.bundleWithURL_(app.bundleURL())
    name = bundle.infoDictionary().get('CFBundleName')
    if name in ('Python', 'MyApp'):
        print name  # => prints Python

So I need to find a way to mark a Python.app instance that runs MyApp script to 
be able to abort launching duplicate instances. Is there such way?

Thanks,
Andrei
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to