[Bug 1945661] Re: openstack commands fail with GTK3 error

David A. Desrosiers 1945661 at bugs.launchpad.net
Thu Apr 4 20:35:33 UTC 2024


I believe I've nailed this one down, after a day of heads-down testing.

The issue boils down to this bit of code, in /usr/lib/python3/dist-
packages/cmd2.py:

    # The extraneous output bug in pyperclip on Linux using xclip was fixed in more recent versions of pyperclip
    if sys.platform.startswith('linux') and pyperclip_ver < 1.6:
        # Avoid extraneous output to stderr from xclip when clipboard is empty at cost of overwriting clipboard contents
        pyperclip.copy('')
    else:
        # Try getting the contents of the clipboard
        _ = pyperclip.paste()

Specifically that last line: `_ = pyperclip.paste()`, which assumes a
clipboard exists and has been initialized. In most cases, it has
not/will not be.

The attached diff to cmd2.py will allow these commands to succeed. I
initially added some debug to allow me to see if the clipboard was
accessible or not, and that's how I found this.

Let me know if this is sufficient to SRU into the python3-cmd2 package
to address this.


** Patch added: "cmd2-diff.patch"
   https://bugs.launchpad.net/ubuntu/+source/python-openstackclient/+bug/1945661/+attachment/5761586/+files/cmd2-diff.patch

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to python-openstackclient in Ubuntu.
https://bugs.launchpad.net/bugs/1945661

Title:
  openstack commands fail with GTK3 error

Status in python-openstackclient package in Ubuntu:
  Confirmed

Bug description:
  Openstack release: Wallaby
  OS: Ubuntu 20.04 server edition
  After installation of python3-openstackclient from apt, while setting up user, roles and project, I executed following command: 
  openstack domain create --description "An Example Domain" example

  Error: 
  Traceback (most recent call last):
    File "/usr/bin/openstack", line 6, in <module>
      from openstackclient.shell import main
    File "/usr/lib/python3/dist-packages/openstackclient/shell.py", line 23, in <module>
      from osc_lib import shell
    File "/usr/lib/python3/dist-packages/osc_lib/shell.py", line 24, in <module>
      from cliff import app
    File "/usr/lib/python3/dist-packages/cliff/app.py", line 22, in <module>
      import cmd2
    File "/usr/lib/python3/dist-packages/cmd2.py", line 585, in <module>
      _ = pyperclip.paste()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 667, in lazy_load_stub_paste
      copy, paste = determine_clipboard()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 558, in determine_clipboard
      return init_gi_clipboard()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 167, in init_gi_clipboard
      gi.require_version('Gtk', '3.0')
    File "/usr/lib/python3/dist-packages/gi/__init__.py", line 129, in require_version
      raise ValueError('Namespace %s not available' % namespace)

  Had to install GTK3 to make openstack commands work but it is taking
  huge time to get a response to the commands. The wait time after
  firing any openstack cli command is around 30 seconds.

  Anybody faced the issue? What is the fix for it if it exists?

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-openstackclient/+bug/1945661/+subscriptions




More information about the Ubuntu-openstack-bugs mailing list