Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #92256
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2015-06-07 07:31 -0700 |
| Message-ID | <a3be1707-0eae-46fa-9921-e9c145816ad5@googlegroups.com> (permalink) |
| Subject | Detect if specific Python.app instance is already running |
| From | Andrei <andrei.fokau@gmail.com> |
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
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Detect if specific Python.app instance is already running Andrei <andrei.fokau@gmail.com> - 2015-06-07 07:31 -0700
Re: Detect if specific Python.app instance is already running Andrei <andrei.fokau@gmail.com> - 2015-06-07 12:54 -0700
Re: Detect if specific Python.app instance is already running Ned Deily <nad@acm.org> - 2015-06-07 16:07 -0700
Re: Detect if specific Python.app instance is already running Andrei <andrei.fokau@gmail.com> - 2015-06-08 01:32 -0700
Re: Detect if specific Python.app instance is already running Laura Creighton <lac@openend.se> - 2015-06-08 20:21 +0200
Re: Detect if specific Python.app instance is already running Ned Deily <nad@acm.org> - 2015-06-12 12:08 -0700
csiph-web