How to use the pyperclip.exceptions function in pyperclip

To help you get started, we’ve selected a few pyperclip examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spaceshuttl / visionary / visionarypm / __init__.py View on Github external
def copy_to_clipboard(generated):
    global copied
    selection = safe_input('Which password would you like to copy? [1/2/3] ').strip()
    if selection in ['1', '2', '3']:
        password = generated[int(selection) - 1]
    else:
        print(color('Invalid option. Pick either 1, 2 or 3.\n', Fore.RED))
        return copy_to_clipboard(generated)
    try:
        pyperclip.copy(password)
        copied = True
        print('\nCopied!\n')
    except pyperclip.exceptions.PyperclipException:
        print(color('Could not copy! If you\'re using linux, make sure xclip is installed.\n', Fore.RED))
github AnemoneLabs / unmessage / unmessage / peer.py View on Github external
def copy_to_clipboard(self, data):
        try:
            pyperclip.copy(data)
        except pyperclip.exceptions.PyperclipException:
            self._ui.notify_error(errors.UnmessageError(
                title='Clipboard error',
                message='A copy/paste mechanism for your system could not be '
                        'found'))