Skip to content

TypeError: 'module' object is not callable when running with --systemd #344

@takase1121

Description

@takase1121

What happened?

Running yin_yang --systemd throws a TypeError: 'module' object is not callable error.
Apparently this is because the --systemd code path does not call sys.exit(), which means the module finishes loading and pip's wrapper attempts to call __main__(), which is a module and thus not callable.

For reference, this is the wrapper executable generated by pip on my system.

#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from yin_yang import __main__
if __name__ == "__main__":
    sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
    sys.exit(__main__())

yin_yang.__main__ is not callable since it is a module, not a function.
This also affects the -t switch.

theme_switcher.set_mode(not config.dark_mode)

theme_switcher.set_desired_theme()

Does not happen on the main (GUI) code path because it calls sys.exit():

sys.exit(app.exec())

Version

master d6b9c4f

How did you install Yin & Yang?

AUR

What desktop environments are you seeing the problem on?

KDE

Which plugin causes the issue?

None

What software version do you use?

No response

Relevant log output

Traceback (most recent call last):
  File "/usr/bin/yin_yang", line 8, in <module>
    sys.exit(__main__())
             ~~~~~~~~^^
TypeError: 'module' object is not callable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions