Skip to content

Commit 0ec71cd

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

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
@@ -267,7 +267,7 @@ def test_default_open(self):
267267
url = "https://python.org"
268268
self.browser.open(url)
269269
self.assertTrue(self.popen_pipe._closed)
270-
self.assertEqual(self.popen_pipe.cmd, "osascript")
270+
self.assertEqual(self.popen_pipe.cmd, "/usr/bin/osascript")
271271
script = self.popen_pipe.pipe.getvalue()
272272
self.assertEqual(script.strip(), f'open location "{url}"')
273273

Lib/turtledemo/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def __init__(self, filename=None):
137137
# so that our menu bar appears.
138138
subprocess.run(
139139
[
140-
'osascript',
140+
'/usr/bin/osascript',
141141
'-e', 'tell application "System Events"',
142142
'-e', 'set frontmost of the first process whose '
143143
'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
@@ -713,7 +713,7 @@ def open(self, url, new=0, autoraise=True):
713713
end
714714
'''%(self.name, url.replace('"', '%22'))
715715

716-
osapipe = os.popen("osascript", "w")
716+
osapipe = os.popen("/usr/bin/osascript", "w")
717717
if osapipe is None:
718718
return False
719719

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)