Cross-platform clipboard utilities supporting both binary and text data.
Project description
pyperclip3
Cross-platform clipboard utilities supporting both binary and text data.
Some key features include:
- A cross-platform API (supports MacOS, Windows, Linux)
- Can handle arbitrary binary data
- On Windows, some additional clipboard formats are supported
Installation
Requires python 3.7+
pip install pyperclip3
Usage
pyperclip3 can be used in Python code
import pyperclip3
pyperclip3.copy("hello clipboard") # copy data to the clipboard
cb_data = pyperclip3.paste() # retrieve clipboard contents
print(cb_data)
pyperclip3.clear() # clears the clipboard contents
assert not pyperclip3.paste()
Or a CLI
# paste clipboard contents to stdout
python -m pyperclip3 paste
# load contents to the clipboard from stdin
python -m pyperclip3 copy < myfile.text
# same as above, but pipe from another command
some-program | python -m pyperclip3 copy
Status
This library will implement functionality for several platforms and clipboard utilities.
- MacOS (via
pbcopy
/pbpaste
) - Windows
- Linux (xclip - coming soon)
- Linux (xsel - coming soon)
If there is a platform or utility not currently listed, please request it by creating an issue.
Platform specific notes/issues
Windows
- On Windows, the
pywin32
package is required. - On Windows, additional clipboard formats are supported, including copying from a file (like if you right-click copy from File Explorer)
MacOS
There is a known issue that pbcopy
/pbpaste
do not support arbitrary binary data.
Linux
Linux requires xclip
or xsel
to work. Install with your package manager, e.g. sudo apt install ...
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyperclip3-0.2.1.tar.gz
(11.4 kB
view hashes)
Built Distribution
pyperclip3-0.2.1-py3-none-any.whl
(14.1 kB
view hashes)
Close
Hashes for pyperclip3-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59878f3e5f63c5ac8065106e28f1c1b5b8bd2ee6bdc791e910cb13886ccd86cf |
|
MD5 | 6d9aa2ecd154e1113fc57622942d0c90 |
|
BLAKE2b-256 | 7ba372adced52ca2581812e6406532d263f6ff6feff7f47dbbaebab0e113abe0 |