Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-40477: macOS Python Launcher app fixes for recent macOS releases #30348

Merged
merged 1 commit into from Jan 3, 2022

Conversation

ned-deily
Copy link
Member

@ned-deily ned-deily commented Jan 3, 2022

The PR here solves two problems encountered by users of the macOS Python Launcher app on recent macOS releases (10.14+):

  1. The launcher app was no longer able to launch the macOS Terminal.app to run a script.
  2. Even if Terminal.app was already launched, the launcher app was unable to send an Apple Event to Terminal.app to open and run Python with the desired .py file.

The solution to item 1 was to no longer specify an absolute path to Terminal.app but rather let LaunchServices figure out the path.

Item 2 was fixed by adding the NSAppleEventsUsageDescription key to the launcher app's property list. The first time the launcher runs, macOS displays a message to the user requesting permission to use Apple events; if granted by the user, the launcher will now be able to send open events to Terminal.app and all is well.

Tested on the most recent releases of macOS 12, 11, 10.16, 10.15, 10.14, and 10.9 and on both Intel and Apple Silicon Macs.

Thanks to @ronaldoussoren for tracking down the NSAppleEventsUsageDescription requirement!

https://bugs.python.org/issue40477

@ned-deily ned-deily requested a review from as a code owner Jan 3, 2022
@ned-deily ned-deily merged commit 549e628 into python:main Jan 3, 2022
12 checks passed
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jan 3, 2022

Thanks @ned-deily for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒🤖

@ned-deily ned-deily deleted the bpo-40477-launcher-terminal branch Jan 3, 2022
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jan 3, 2022

GH-30349 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 3, 2022
…ythonGH-30348)

This change solves two problems encountered by users of the macOS Python Launcher app on recent macOS releases (10.14+):

- The launcher app was no longer able to launch the macOS Terminal.app to run a script.

- Even if Terminal.app was already launched, the launcher app was unable to send an Apple Event to Terminal.app to open and run Python with the desired .py file.
(cherry picked from commit 549e628)

Co-authored-by: Ned Deily <nad@python.org>
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jan 3, 2022

GH-30350 is a backport of this pull request to the 3.9 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 3, 2022
…ythonGH-30348)

This change solves two problems encountered by users of the macOS Python Launcher app on recent macOS releases (10.14+):

- The launcher app was no longer able to launch the macOS Terminal.app to run a script.

- Even if Terminal.app was already launched, the launcher app was unable to send an Apple Event to Terminal.app to open and run Python with the desired .py file.
(cherry picked from commit 549e628)

Co-authored-by: Ned Deily <nad@python.org>
ned-deily added a commit that referenced this issue Jan 3, 2022
…H-30348) (GH-30349)

This change solves two problems encountered by users of the macOS Python Launcher app on recent macOS releases (10.14+):

- The launcher app was no longer able to launch the macOS Terminal.app to run a script.

- Even if Terminal.app was already launched, the launcher app was unable to send an Apple Event to Terminal.app to open and run Python with the desired .py file.
(cherry picked from commit 549e628)

Co-authored-by: Ned Deily <nad@python.org>
miss-islington added a commit that referenced this issue Jan 3, 2022
…H-30348)

This change solves two problems encountered by users of the macOS Python Launcher app on recent macOS releases (10.14+):

- The launcher app was no longer able to launch the macOS Terminal.app to run a script.

- Even if Terminal.app was already launched, the launcher app was unable to send an Apple Event to Terminal.app to open and run Python with the desired .py file.
(cherry picked from commit 549e628)

Co-authored-by: Ned Deily <nad@python.org>
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jan 3, 2022

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Arch Linux Asan 3.10 has failed when building commit b312794.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/633/builds/407) and take a look at the build logs.
  4. Check if the failure is related to this commit (b312794) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/633/builds/407

Summary of the results of the build (if available):

Click to see traceback logs
Traceback (most recent call last):
  File "/buildbot/buildarea/3.10.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/resource_tracker.py", line 209, in main
    cache[rtype].remove(name)
KeyError: '/psm_f0db36c1'


Traceback (most recent call last):
  File "/buildbot/buildarea/3.10.pablogsal-arch-x86_64.asan/build/Lib/multiprocessing/resource_tracker.py", line 209, in main
    cache[rtype].remove(name)
KeyError: '/psm_c4ae8d17'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants