Skip to content

Commit c358b89

Browse files
miss-islingtonfionnhugovk
authored
[3.13] gh-137586: Open external osascript program with absolute path (GH-137584) (#148174)
Co-authored-by: Fionn <1897918+fionn@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent 4dfcdbe commit c358b89

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

Lib/test/test_webbrowser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def test_default_open(self):
350350
url = "https://python.org"
351351
self.browser.open(url)
352352
self.assertTrue(self.popen_pipe._closed)
353-
self.assertEqual(self.popen_pipe.cmd, "osascript")
353+
self.assertEqual(self.popen_pipe.cmd, "/usr/bin/osascript")
354354
script = self.popen_pipe.pipe.getvalue()
355355
self.assertEqual(script.strip(), f'open location "{url}"')
356356

Lib/turtledemo/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def __init__(self, filename=None):
138138
# so that our menu bar appears.
139139
subprocess.run(
140140
[
141-
'osascript',
141+
'/usr/bin/osascript',
142142
'-e', 'tell application "System Events"',
143143
'-e', 'set frontmost of the first process whose '
144144
'unix id is {} to true'.format(os.getpid()),

Lib/webbrowser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ def open(self, url, new=0, autoraise=True):
619619
end
620620
'''
621621

622-
osapipe = os.popen("osascript", "w")
622+
osapipe = os.popen("/usr/bin/osascript", "w")
623623
if osapipe is None:
624624
return False
625625

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Invoke :program:`osascript` with absolute path in :mod:`webbrowser` and :mod:`!turtledemo`.

0 commit comments

Comments
 (0)