Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • S Solaar
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 10
    • Issues 10
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pwr-Solaar
  • Solaar
  • Issues
  • #462
Closed
Open
Issue created Sep 04, 2018 by Administrator@rootContributor

Backtrace when run without gtk installed

Created by: jasontibbitts

If you try to bring up the graphical interface without gtk installed, you get a backtrace:

Traceback (most recent call last):
  File "/usr/bin/solaar", line 57, in <module>
    solaar.gtk.main()
  File "/usr/lib/python3.7/site-packages/solaar/gtk.py", line 90, in main
    gi.require_version('Gtk', '3.0')
  File "/usr/lib64/python3.7/site-packages/gi/__init__.py", line 127, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk not available

It does appear that there is code to handle missing modules, but gtk doesn't get imported directly so it wouldn't trigger. Maybe something like this?

diff --git a/lib/solaar/gtk.py b/lib/solaar/gtk.py
index f728420..20683af 100644
--- a/lib/solaar/gtk.py
+++ b/lib/solaar/gtk.py
@@ -87,8 +87,11 @@ def main():
        if not args: return
        if args.action: return _cli.run(args.action, args.hidraw_path)

-       gi = _require('gi', 'python-gi')
-       gi.require_version('Gtk', '3.0')
+       try:
+               gi.require_version('Gtk', '3.0')
+       except ValueError:
+               import sys
+               sys.exit("%s: Gtk (version 3) must be installed in order to run the graphical interface." % (NAME))
        _require('gi.repository.Gtk', 'gir1.2-gtk-3.0')

        try:

Can send a PR if desired, but I don't know if that's the right approach.

Assignee
Assign to
Time tracking