Skip to content

Commit 20b4393

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

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
@@ -139,7 +139,7 @@ def __init__(self, filename=None):
139139
# so that our menu bar appears.
140140
subprocess.run(
141141
[
142-
'osascript',
142+
'/usr/bin/osascript',
143143
'-e', 'tell application "System Events"',
144144
'-e', 'set frontmost of the first process whose '
145145
'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
@@ -660,7 +660,7 @@ def open(self, url, new=0, autoraise=True):
660660
end
661661
'''%(self.name, url.replace('"', '%22'))
662662

663-
osapipe = os.popen("osascript", "w")
663+
osapipe = os.popen("/usr/bin/osascript", "w")
664664
if osapipe is None:
665665
return False
666666

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)