Skip to content

Commit e70ff77

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

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
@@ -694,7 +694,7 @@ def open(self, url, new=0, autoraise=True):
694694
end
695695
'''%(self._name, url.replace('"', '%22'))
696696

697-
osapipe = os.popen("osascript", "w")
697+
osapipe = os.popen("/usr/bin/osascript", "w")
698698
if osapipe is None:
699699
return False
700700

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)