MCPcopy Create free account
hub / github.com/ipython/ipython / osx_clipboard_get

Function osx_clipboard_get

IPython/lib/clipboard.py:35–44  ·  view source on GitHub ↗

Get the clipboard's text on OS X.

()

Source from the content-addressed store, hash-verified

33 return text
34
35def osx_clipboard_get() -> str:
36 """ Get the clipboard's text on OS X.
37 """
38 p = subprocess.Popen(['pbpaste', '-Prefer', 'ascii'],
39 stdout=subprocess.PIPE)
40 bytes_, stderr = p.communicate()
41 # Text comes in with old Mac \r line endings. Change them to \n.
42 bytes_ = bytes_.replace(b'\r', b'\n')
43 text = py3compat.decode(bytes_)
44 return text
45
46def tkinter_clipboard_get():
47 """ Get the clipboard's text using Tkinter.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected