You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

pyperclip3

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyperclip3

Cross-platform clipboard utilities supporting both binary and text data.


Maintainers
1

Readme

This project Has Moved

Please see https://pypi.org/project/pyclip/

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 pyclip 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

Installing via pip also provides console script pyclip:

pyclip copy < my_file.txt

This library implements functionality for several platforms and clipboard utilities.

  • MacOS
  • Windows
  • Linux (with xclip)

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 installed as a requirement.
  • On Windows, additional clipboard formats are supported, including copying from a file (like if you right-click copy from File Explorer)

MacOS

MacOS has support for multiple backends. By default, the pasteboard package is used.

pbcopy/pbpaste can also be used as a backend, but does not support arbitrary binary data, which may lead to data being lost on copy/paste. This backend may be removed in a future release.

Linux

Linux requires xclip to work (which means you must also use X). Install with your package manager, e.g. sudo apt install xclip

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc