mandeep / Travis-Encrypt

Encrypt environment variables and passwords for use with Travis CI
MIT License
17 stars 3 forks source link

Exception when using --clipboard [Pyperclip could not find a copy/paste mechanism for your system.] #16

Open JoelMon opened 5 years ago

JoelMon commented 5 years ago

System

Ubuntu 10.04

Python Installed

Installation

Installed travis-encrypt via pip3

travis-encrypt (1.3.1)                          - Encrypt passwords for use with Travis CI.
  INSTALLED: 1.3.1 (latest)

Python's Trackback

Traceback (most recent call last):
  File "/home/user/.local/bin/travis-encrypt", line 10, in <module>
    sys.exit(cli())
  File "/home/user/.local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/.local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/user/.local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user/.local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/user/.local/lib/python3.7/site-packages/travis/cli.py", line 110, in cli
    pyperclip.copy(encrypted_password)
  File "/home/user/.local/lib/python3.7/site-packages/pyperclip/__init__.py", line 616, in lazy_load_stub_copy
    return copy(text)
  File "/home/user/.local/lib/python3.7/site-packages/pyperclip/__init__.py", line 301, in __call__
    raise PyperclipException(EXCEPT_MSG)
pyperclip.PyperclipException: 
    Pyperclip could not find a copy/paste mechanism for your system.
    For more information, please visit https://pyperclip.readthedocs.io/en/latest/introduction.html#not-implemented-error 
mandeep commented 5 years ago

Thanks for the report. Does installing xsel or xclip from apt help solve this problem?

JoelMon commented 5 years ago

Works as expected when xsel or xclip are installed.

Feature request

JoelMon commented 5 years ago

If you want to incorporate the above ideas, or in part, would it be ok if I give it a shot and merge in? Seems simple enough for me to handle.

mandeep commented 5 years ago

Sure! All PRs are appreciated. :)

JoelMon commented 5 years ago

Wonderful! tomorrow I'll get started.

JoelMon commented 5 years ago

What do you think about this error message:

Pyperclip could not find a copy/paste mechanism for your system.

On Windows, no additional modules are needed.
On Mac, the pyobjc module is used, falling back to the pbcopy and pbpaste cli
    commands. (These commands should come with OS X.).
On Linux, install xclip or xsel via package manager. For example, in Debian:
    sudo apt-get install xclip
    sudo apt-get install xsel

Otherwise on Linux, you will need the gtk or PyQt5/PyQt4 modules installed.

gtk and PyQt4 modules are not available for Python 3,
and this module does not work with PyGObject yet.

Note: There seems to be a way to get gtk on Python 3, according to:
    https://askubuntu.com/questions/697397/python3-is-not-supporting-gtk-module

Cygwin is currently not supported.

For more information, please visit https://pyperclip.readthedocs.io/en/latest/introduction.html#not-implemented-error 

Is that good or too much?

mandeep commented 5 years ago

This is a great start! I can think of a few changes.

Instead of writing a message for Windows and Mac, I would write something along the lines of If you're seeing this error on Windows or Mac please visit https://pyperclip.readthedocs.io/en/latest/introduction.html#not-implemented-error or maybe point to the pyperclip issue tracker.

Also, instead of writing things about gtk, PyQt, and PyGObject, I would direct people to the same website. I don't think it's Travis-Encrypt's job to solve dependency issues apart from xsel and xclip.