buzz / volctl

Per-application volume control and OSD for Linux desktops.
https://buzz.github.io/volctl/
GNU General Public License v2.0
132 stars 19 forks source link

ValueError: invalid enum value: 15 in gi #71

Closed user234683 closed 1 year ago

user234683 commented 1 year ago

Installation:

$ sudo python3 ./setup.py install
running install
running bdist_egg
running egg_info
creating volctl.egg-info
writing volctl.egg-info/PKG-INFO
writing dependency_links to volctl.egg-info/dependency_links.txt
writing entry points to volctl.egg-info/entry_points.txt
writing requirements to volctl.egg-info/requires.txt
writing top-level names to volctl.egg-info/top_level.txt
writing manifest file 'volctl.egg-info/SOURCES.txt'
reading manifest file 'volctl.egg-info/SOURCES.txt'
writing manifest file 'volctl.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/volctl
copying volctl/prefs.py -> build/lib/volctl
copying volctl/app.py -> build/lib/volctl
copying volctl/meta.py -> build/lib/volctl
copying volctl/osd.py -> build/lib/volctl
copying volctl/__main__.py -> build/lib/volctl
copying volctl/pulsemgr.py -> build/lib/volctl
copying volctl/xwrappers.py -> build/lib/volctl
copying volctl/status_icon.py -> build/lib/volctl
copying volctl/slider_win.py -> build/lib/volctl
copying volctl/__init__.py -> build/lib/volctl
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/volctl
copying build/lib/volctl/prefs.py -> build/bdist.linux-x86_64/egg/volctl
copying build/lib/volctl/app.py -> build/bdist.linux-x86_64/egg/volctl
copying build/lib/volctl/meta.py -> build/bdist.linux-x86_64/egg/volctl
copying build/lib/volctl/osd.py -> build/bdist.linux-x86_64/egg/volctl
copying build/lib/volctl/__main__.py -> build/bdist.linux-x86_64/egg/volctl
copying build/lib/volctl/pulsemgr.py -> build/bdist.linux-x86_64/egg/volctl
copying build/lib/volctl/xwrappers.py -> build/bdist.linux-x86_64/egg/volctl
copying build/lib/volctl/status_icon.py -> build/bdist.linux-x86_64/egg/volctl
copying build/lib/volctl/slider_win.py -> build/bdist.linux-x86_64/egg/volctl
copying build/lib/volctl/__init__.py -> build/bdist.linux-x86_64/egg/volctl
byte-compiling build/bdist.linux-x86_64/egg/volctl/prefs.py to prefs.cpython-39.pyc
byte-compiling build/bdist.linux-x86_64/egg/volctl/app.py to app.cpython-39.pyc
byte-compiling build/bdist.linux-x86_64/egg/volctl/meta.py to meta.cpython-39.pyc
byte-compiling build/bdist.linux-x86_64/egg/volctl/osd.py to osd.cpython-39.pyc
byte-compiling build/bdist.linux-x86_64/egg/volctl/__main__.py to __main__.cpython-39.pyc
byte-compiling build/bdist.linux-x86_64/egg/volctl/pulsemgr.py to pulsemgr.cpython-39.pyc
byte-compiling build/bdist.linux-x86_64/egg/volctl/xwrappers.py to xwrappers.cpython-39.pyc
byte-compiling build/bdist.linux-x86_64/egg/volctl/status_icon.py to status_icon.cpython-39.pyc
byte-compiling build/bdist.linux-x86_64/egg/volctl/slider_win.py to slider_win.cpython-39.pyc
byte-compiling build/bdist.linux-x86_64/egg/volctl/__init__.py to __init__.cpython-39.pyc
installing package data to build/bdist.linux-x86_64/egg
running install_data
creating build/bdist.linux-x86_64/egg/share
creating build/bdist.linux-x86_64/egg/share/applications
copying data/volctl.desktop -> build/bdist.linux-x86_64/egg/share/applications
creating build/bdist.linux-x86_64/egg/share/glib-2.0
creating build/bdist.linux-x86_64/egg/share/glib-2.0/schemas
copying data/apps.volctl.gschema.xml -> build/bdist.linux-x86_64/egg/share/glib-2.0/schemas
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying volctl.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying volctl.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying volctl.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying volctl.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying volctl.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying volctl.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/volctl-0.9.2-py3.9.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing volctl-0.9.2-py3.9.egg
Copying volctl-0.9.2-py3.9.egg to /usr/local/lib/python3.9/dist-packages
Adding volctl 0.9.2 to easy-install.pth file
Installing volctl script to /usr/local/bin

Installed /usr/local/lib/python3.9/dist-packages/volctl-0.9.2-py3.9.egg
Processing dependencies for volctl==0.9.2
Searching for pulsectl
Reading https://pypi.org/simple/pulsectl/
Downloading https://files.pythonhosted.org/packages/e7/dc/53454b4d9f52f53aa5d95b0c5aa1adaf80e324f760e9086db4e2de2dab24/pulsectl-22.3.2-py2.py3-none-any.whl#sha256=6fded96a8e6a9ac6c387ed3a9bdb1afb20d80256b0c9df4b98b58461d74ba0c4
Best match: pulsectl 22.3.2
Processing pulsectl-22.3.2-py2.py3-none-any.whl
Installing pulsectl-22.3.2-py2.py3-none-any.whl to /usr/local/lib/python3.9/dist-packages
Adding pulsectl 22.3.2 to easy-install.pth file

Installed /usr/local/lib/python3.9/dist-packages/pulsectl-22.3.2-py3.9.egg
Searching for click
Reading https://pypi.org/simple/click/
Downloading https://files.pythonhosted.org/packages/c2/f1/df59e28c642d583f7dacffb1e0965d0e00b218e0186d7858ac5233dce840/click-8.1.3-py3-none-any.whl#sha256=bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48
Best match: click 8.1.3
Processing click-8.1.3-py3-none-any.whl
Installing click-8.1.3-py3-none-any.whl to /usr/local/lib/python3.9/dist-packages
Adding click 8.1.3 to easy-install.pth file

Installed /usr/local/lib/python3.9/dist-packages/click-8.1.3-py3.9.egg
Searching for PyYAML
Reading https://pypi.org/simple/PyYAML/
Downloading https://files.pythonhosted.org/packages/12/fc/a4d5a7554e0067677823f7265cb3ae22aed8a238560b5133b58cda252dad/PyYAML-6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl#sha256=40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0
Best match: PyYAML 6.0
Processing PyYAML-6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Installing PyYAML-6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl to /usr/local/lib/python3.9/dist-packages
Adding PyYAML 6.0 to easy-install.pth file

Installed /usr/local/lib/python3.9/dist-packages/PyYAML-6.0-py3.9-linux-x86_64.egg
Searching for pycairo==1.16.2
Best match: pycairo 1.16.2
Adding pycairo 1.16.2 to easy-install.pth file

Using /usr/lib/python3/dist-packages
Searching for PyGObject==3.38.0
Best match: PyGObject 3.38.0
Adding PyGObject 3.38.0 to easy-install.pth file

Using /usr/lib/python3/dist-packages
Finished processing dependencies for volctl==0.9.2
$ sudo update-desktop-database
$ sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
$ sudo glib-compile-schemas /usr/local/share/glib-2.0/schemas/

Error:

$ volctl
Traceback (most recent call last):
  File "/usr/local/bin/volctl", line 33, in <module>
    sys.exit(load_entry_point('volctl==0.9.2', 'gui_scripts', 'volctl')())
  File "/usr/local/bin/volctl", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/local/lib/python3.9/dist-packages/volctl-0.9.2-py3.9.egg/volctl/__main__.py", line 12, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/local/lib/python3.9/dist-packages/volctl-0.9.2-py3.9.egg/volctl/app.py", line 7, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/local/lib/python3.9/dist-packages/volctl-0.9.2-py3.9.egg/volctl/meta.py", line 7, in <module>
  File "/usr/lib/python3/dist-packages/gi/overrides/__init__.py", line 32, in __getattr__
    return getattr(self._introspection_module, name)
  File "/usr/lib/python3/dist-packages/gi/module.py", line 155, in __getattr__
    setattr(wrapper, value_name, wrapper(value_info.get_value()))
ValueError: invalid enum value: 15

System: Debian GNU/Linux 11 (bullseye), upgraded from Debian 10 Python 3.9.2 (system installation)

user234683 commented 1 year ago

It seems to be because of this line: Gtk.License.GPL_2_0 I can reproduce it in a terminal:

$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> 
>>> gi.require_version("Gdk", "3.0")
>>> gi.require_version("GdkX11", "3.0")
>>> gi.require_version("Gio", "2.0")
>>> gi.require_version("GLib", "2.0")
>>> gi.require_version("GObject", "2.0")
>>> gi.require_version("Gtk", "3.0")
>>> # pylint: disable=wrong-import-position
>>> from gi.repository import Gtk
>>> from gi.repository import Gdk, Gio, Gtk
>>> from gi.repository import Gtk
>>> Gtk.License.GPL_2_0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/gi/overrides/__init__.py", line 32, in __getattr__
    return getattr(self._introspection_module, name)
  File "/usr/lib/python3/dist-packages/gi/module.py", line 155, in __getattr__
    setattr(wrapper, value_name, wrapper(value_info.get_value()))
ValueError: invalid enum value: 15
>>> Gtk.License.GPL_2_0
<enum GTK_LICENSE_GPL_2_0 of type Gtk.License>

It works the second time the attribute is accessed. I think that library is overengineering that attribute and is best avoided, so maybe replace with a string like this? LICENSE = "GPLv2" Doing that and rebuilding the egg file fixed that error, but I have a new error in the next issue.

Also would it be possible to make /usr/local/lib/python3.9/dist-packages/volctl-0.9.2-py3.9.egg a directory like the other packages are instead of a zip file? It makes it more difficult to debug these issues and make modifications

buzz commented 1 year ago

Gtk.License.GPL_2_0 is available as per API docs.

I can't reproduce the issue. I assume your GI/Gtk installation is somehow borked?

Closing as it's not an issue with volctl.