MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / open

Method open

tools/python-3.11.9-amd64/Lib/webbrowser.py:690–708  ·  view source on GitHub ↗
(self, url, new=0, autoraise=True)

Source from the content-addressed store, hash-verified

688 self.name = val
689
690 def open(self, url, new=0, autoraise=True):
691 sys.audit("webbrowser.open", url)
692 if self.name == 'default':
693 script = 'open location "%s"' % url.replace('"', '%22') # opens in default browser
694 else:
695 script = f'''
696 tell application "%s"
697 activate
698 open location "%s"
699 end
700 '''%(self.name, url.replace('"', '%22'))
701
702 osapipe = os.popen("osascript", "w")
703 if osapipe is None:
704 return False
705
706 osapipe.write(script)
707 rc = osapipe.close()
708 return not rc
709
710
711def main():

Callers

nothing calls this directly

Calls 3

replaceMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected