Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hitting Apply gives TypeError: can only concatenate str #171

Closed
technout opened this issue Jul 7, 2023 · 11 comments
Closed

Hitting Apply gives TypeError: can only concatenate str #171

technout opened this issue Jul 7, 2023 · 11 comments
Labels
bug Something isn't working

Comments

@technout
Copy link

technout commented Jul 7, 2023

What happened?

App does not work on my up to date Manjaro system with gnome 44.1. When i change a toggle or background, i always get this error in debug mode:

$ ./Downloads/Login_Manager_Settings.AppImage -v
INFO: Application Version    = 3.2
INFO: Operating System       = Manjaro Linux
INFO: PackageType            = AppImage
INFO: TEMP_DIR               = /run/user/1000/app/io.github.realmazharhussain.GdmSettings
INFO: HOST_DATA_DIRS         = /usr/local/share:/usr/share
INFO: ShellGresourceFile     = /usr/share/gnome-shell/gnome-shell-theme.gresource
INFO: UbuntuGdmGresourceFile = None
INFO: pkexec version 122
Traceback (most recent call last):
  File "/tmp/.mount_App_Lo5lLsRe/usr/lib/python3.11/site-packages/gdm_settings/lib/background_task.py", line 26, in <lambda>
    finish_callback = lambda self, task, nothing: self.finish_callback()
                                                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.mount_App_Lo5lLsRe/usr/lib/python3.11/site-packages/gdm_settings/window.py", line 136, in on_apply_finished
    if self.apply_task.finish():
       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.mount_App_Lo5lLsRe/usr/lib/python3.11/site-packages/gdm_settings/lib/background_task.py", line 51, in finish
    raise value
  File "/tmp/.mount_App_Lo5lLsRe/usr/lib/python3.11/site-packages/gdm_settings/lib/background_task.py", line 36, in _thread_cb
    retval = self.function()
             ^^^^^^^^^^^^^^^
  File "/tmp/.mount_App_Lo5lLsRe/usr/lib/python3.11/site-packages/gdm_settings/settings.py", line 568, in apply_settings
    self.apply_shell_theme_settings()
  File "/tmp/.mount_App_Lo5lLsRe/usr/lib/python3.11/site-packages/gdm_settings/settings.py", line 351, in apply_shell_theme_settings
    compiled_file = gr_utils.compile(shelldir,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.mount_App_Lo5lLsRe/usr/lib/python3.11/site-packages/gdm_settings/gr_utils.py", line 99, in compile
    extract_default_theme(temp_theme_dir)
  File "/tmp/.mount_App_Lo5lLsRe/usr/lib/python3.11/site-packages/gdm_settings/gr_utils.py", line 67, in extract_default_theme
    resource_list = lib.get_stdout(["gresource", "list", env.HOST_ROOT + gresource_file]).splitlines()
                                                         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str

Also no changes are saved after hitting apply and closing the app and reopening the app again.

Expected behavior

Changes must be saved

I read a few bug reports about problems with gnome 44 in the last months.
Tip: Maybe a good idea to tell people on front page that this app does not work well with gnome 44

To Reproduce

Start App
Change a toggle
Hit apply
Logout
See the login screen (no changes made)

Detailed Explanation (Optional)

No response

Application Version

3.2

Format/Source

AppImage

Environment

  • OS: Manjaro
  • GNOME: 44.1
@technout technout added the bug Something isn't working label Jul 7, 2023
@technout
Copy link
Author

technout commented Jul 7, 2023

But i have to say, cool project! And very nice interface. Keep up the great work!
Looking forward to using it on Manjaro with Gnome 44.1

@realmazharhussain
Copy link
Member

This exact issue has been reported countless times. There is some problem in the program logic but I cannot figure it out. Part of the reason is that I cannot reproduce this bug.

It only ever happens on the users' systems and never on mine. Even if I have somewhat similar setup. For example, I have used the AppImage on Manjaro with GNOME 44.1, exactly the setup you reported and it worked flawlessly on my system.

If I ever figure something out, I'll let you know. In the meantime, you can switch to an alternative packaging format. The app is available on the AUR and Flathub as well.

I read a few bug reports about problems with gnome 44 in the last months.
Tip: Maybe a good idea to tell people on front page that this app does not work well with gnome 44

Only one bug related to GNOME 44 was reported. That bug has already been fixed (like 3 weeks ago).

@technout
Copy link
Author

I did also try the AUR version. This version unfortunately also gives the same error.
Can i provide more debug info to help you fix this bug? And what can help you reproduce it?
My system is a pretty standard Manjaro system which is about 6 months old, since fresh install.

@realmazharhussain
Copy link
Member

Try reinstalling gnome-shell package.

@realmazharhussain
Copy link
Member

I've also added a graphical dialog which will show up on application startup if gnome-shell package needs to be reinstalled. The dialog will ask you to reinstall gnome-shell package after explaining the situation.

To test out new the dialog, you can install the gdm-settings-git AUR package.

@technout
Copy link
Author

Thank you for the quick update! I did install it and got the new 'reinstall gnome-shell' warning when starting the app.
I also did a bit of research and found this link: https://forum.manjaro.org/t/make-manjaro-gnome-maia-again/129289

Manjaro has the gnome-shell package not installed by default and instead there was gnome-shell-maia installed (see the manjaro forum link). This maia version has some different accent coloring (green instead of blue).

At first i could not install the gnome-shell package unless i removed gnome-shell-maia first, but this was also giving dependency errors, but i did the job. Gnome-shell package in now installed.

Then after a logoff/logon i run the gdm-settings app again and it works!! (no TypeErrors anymore) :)

@technout
Copy link
Author

Maybe for a next minor update: is it possible to also detect the gnome-shell-maia as an unmodified default shell theme?
As it seems this is the default on Manjaro, then it will work without uninstalling gnome-shell-maia and then installing gnome-shell.

@realmazharhussain
Copy link
Member

I looked into it. From what I understand, reinstalling gnome-shell-maia package should have also fixed the problem.

The app assumes the theme as modified only if it contains a file named custom-theme inside it. To my knowledge, only my projects (this app and gdm-tools) put that file into a theme file. gnome-shell-maia does not contain that custom-theme file.

@technout
Copy link
Author

Thanks for looking into it. I did set the gdm-settings back to defaults, removed gnome-shell and installed gnome-shell-maia. Run gdm-settings, changed top bar settings, logged out, saw the change, it works!

I remember starting up gdm-settings for the first time, it did work once then. That must have changed something not correctly, since then the errors came along.
I'm glad it is fixed :)

@tasmirz
Copy link

tasmirz commented Oct 14, 2023

Changing

resource_list = lib.get_stdout(["gresource", "list", env.HOST_ROOT + gresource_file]).splitlines()
if not gresource_file:
        raise FileNotFoundError('No unmodified GResource file of the default shell theme was found')
    

to

if not gresource_file:
        raise FileNotFoundError('No unmodified GResource file of the default shell theme was found')
    resource_list = lib.get_stdout(["gresource", "list", env.HOST_ROOT + gresource_file]).splitlines()

in the https://github.com/gdm-settings/gdm-settings/blob/main/gdms/gresource.py file, the program will atleast show an proper error than crashing.

The main reason for this is: deletion of the Gresource file/ no gresource file provided by the theme.

@realmazharhussain
Copy link
Member

realmazharhussain commented Oct 15, 2023

@tasmirz

Fixed it. However, you should have not been getting an error on the command line in the first place (unless you deleted the default gresource file after launching GDM Settings) because if it needs to, the app shows a graphical error message on launch, describing everything.

if not default_gresouce:
self.show_missing_gresource_dialog()
return

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants