Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Unhandled exception with --clip option #11

Open
a1exsh opened this issue Jan 6, 2016 · 9 comments
Open

Unhandled exception with --clip option #11

a1exsh opened this issue Jan 6, 2016 · 9 comments

Comments

@a1exsh
Copy link

a1exsh commented Jan 6, 2016

$ piu request-access -t 1 --clip 172.31.171.204 test shell history
Requesting access to host 172.31.171.204 via odd-... for oshulgin..
Access to host odd-.../xx.xx.xxx.xxx for user oshulgin was granted.
You can now access your server with the following command:
...

Or just check your clipboard and run ctrl/command + v (requires package "xclip" on Linux)
Traceback (most recent call last):
  File "/home/oshulgin/.local/bin/piu", line 11, in <module>
    sys.exit(main())
  File "/home/oshulgin/.local/lib/python3.5/site-packages/piu/cli.py", line 305, in main
    cli()
  File "/home/oshulgin/.local/lib/python3.5/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/oshulgin/.local/lib/python3.5/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/oshulgin/.local/lib/python3.5/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/oshulgin/.local/lib/python3.5/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/oshulgin/.local/lib/python3.5/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/oshulgin/.local/lib/python3.5/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/home/oshulgin/.local/lib/python3.5/site-packages/piu/cli.py", line 260, in request_access
    user, password, clip)
  File "/home/oshulgin/.local/lib/python3.5/site-packages/piu/cli.py", line 159, in _request_access
    pyperclip.copy(command)
  File "/home/oshulgin/.local/lib/python3.5/site-packages/pyperclip/clipboards.py", line 32, in copy_gtk
    cb = gtk.Clipboard()
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 62, in __getattr__
    raise AttributeError(_static_binding_error)
AttributeError: When using gi.repository you must not import static modules like "gobject". Please change all occurrences of "import gobject" to "from gi.repository import GObject". See: https://bugzilla.gnome.org/show_bug.cgi?id=709183
@hjacobs
Copy link
Contributor

hjacobs commented Jan 6, 2016

Looks like a bug in the pyperclip Python module..

@hjacobs
Copy link
Contributor

hjacobs commented Jan 6, 2016

@a1exsh maybe you can check your pyperclip version (pip3 freeze) and report the issue here: https://github.com/asweigart/pyperclip/issues

@hjacobs
Copy link
Contributor

hjacobs commented Jan 6, 2016

I get the same problem (Xubuntu 15.10):

$ piu 172.31.1.1 test https://github.com/zalando-stups/piu/issues/11 --clip
Requesting access to host 172.31.1.1 via odd-eu-XXX for hjacobs..
Access to host odd-eu-XXX for user hjacobs was granted.
You can now access your server with the following command:
ssh -tA hjacobs@odd-eu-XXX ssh -o StrictHostKeyChecking=no hjacobs@172.31.1.1

Or just check your clipboard and run ctrl/command + v (requires package "xclip" on Linux)
Traceback (most recent call last):
  File "/usr/local/bin/piu", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.4/dist-packages/piu/cli.py", line 305, in main
    cli()
  File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.4/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/piu/cli.py", line 260, in request_access
    user, password, clip)
  File "/usr/local/lib/python3.4/dist-packages/piu/cli.py", line 159, in _request_access
    pyperclip.copy(command)
  File "/usr/local/lib/python3.4/dist-packages/pyperclip/clipboards.py", line 32, in copy_gtk
    cb = gtk.Clipboard()
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 62, in __getattr__
    raise AttributeError(_static_binding_error)
AttributeError: When using gi.repository you must not import static modules like "gobject". Please change all occurrences of "import gobject" to "from gi.repository import GObject". See: https://bugzilla.gnome.org/show_bug.cgi?id=709183
$ pip3 freeze | grep pyperclip
pyperclip==1.5.25
$ python3 --version
Python 3.4.3+

@a1exsh
Copy link
Author

a1exsh commented Jan 6, 2016

I've got the same versions (Ubuntu Gnome 15.10), pyperclip 1.5.25, python 3.4.3+. However if I try it with interactive python prompt, it appears to work:

>>> import pyperclip
>>> pyperclip.copy('test')

Actually, that works only with python3.5, not 3.4. All the 3 packages installed with pip3 go to python3.5 on my system.

@szuecs
Copy link
Member

szuecs commented Jun 27, 2016

Is this issue resolved or what can we do to resolve it?
Maybe adding some documentation that this feature only works with pyperclip version xyz?

@outime
Copy link
Contributor

outime commented Aug 4, 2016

If this is still an issue (can't say as I can't reproduce) perhaps --connect alone could work for some use cases as it directly connects you to the instance so you can skip the copy-pasting part.

@a1exsh
Copy link
Author

a1exsh commented Aug 4, 2016

I'm mostly using --connect these days.

@hjacobs
Copy link
Contributor

hjacobs commented Aug 4, 2016

I guess we can remove the --clip option completely.

@szuecs
Copy link
Member

szuecs commented Aug 15, 2016

If nobody answers, with "No I am using --clip" in the next days we will remove it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants