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

dasbus has different, incompatible interface from dbus-python #177

Open
RedChops opened this issue Oct 24, 2024 · 5 comments
Open

dasbus has different, incompatible interface from dbus-python #177

RedChops opened this issue Oct 24, 2024 · 5 comments

Comments

@RedChops
Copy link

RedChops commented Oct 24, 2024

After getting pantalaimon set up, attempting to run panctl throws the following error:

$ panctl
Traceback (most recent call last):
  File "/Users/self/Projects/Vendor/pantalaimon/venv/bin/panctl", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/pantalaimon/panctl.py", line 704, in main
    panctl = PanCtl()
  File "<attrs generated init pantalaimon.panctl.PanCtl>", line 2, in __init__
    self.__attrs_post_init__()
    ~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/pantalaimon/panctl.py", line 408, in __attrs_post_init__
    self.pan_bus = self.bus.get_connection("org.pantalaimon1")
                   ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'SessionMessageBus' object has no attribute 'get_connection'. Did you mean: 'check_connection'?

I tried to replace get_connection with just connection but then run in to

Traceback (most recent call last):
  File "/Users/self/Projects/Vendor/pantalaimon/venv/bin/panctl", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/pantalaimon/panctl.py", line 704, in main
    panctl = PanCtl()
  File "<attrs generated init pantalaimon.panctl.PanCtl>", line 2, in __init__
    self.__attrs_post_init__()
    ~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/pantalaimon/panctl.py", line 410, in __attrs_post_init__
    self.ctl = self.pan_bus["org.pantalaimon1.control"]
               ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'DBusConnection' object is not subscriptable

Being completely unfamiliar with dbus, I tried a couple more things to get it running again but I couldn't derive the intention behind this code so I'm not sure what the right dasbus version would be.

My steps to get this set up (on Mac):

  1. Clone repo
  2. python3 -m venv venv
  3. source venv/bin/activate
  4. pip install .
  5. pip install matrix_nio==0.25.2 PyGObject dasbus <- For whatever reason neither PyGObject nor dasbus are installed automatically, I have to install them manually here. I also have to manually upgrade matrix_nio as I mentioned in another ticket
  6. Start pantalaimon, run panctl in another terminal both inside the virtual env
@chookity-pokk
Copy link
Collaborator

Sorry for the delayed response. I am looking into this now and am hoping to have a PR out soon. I also updated the README to say that you need to run pip install .[ui] to install the extra packages. Though I also might but add them in with the default packages.

@chookity-pokk
Copy link
Collaborator

@RedChops Can you test out #180? It seems to work on my end but I want to make sure that it's working for others.

@RedChops
Copy link
Author

@chookity-pokk Ran in to two things while testing:

  1. PyGObject dependency in setup.py is too old, I hit this. Changing the requirement to "PyGObject >= 3.46, < 3.50" fixed it. Basically needed a version of gobject-introspection newer than 4 years
  2. I set up dbus according to the readme, set the environment variables:
echo $DBUS_SESSION_BUS_ADDRESS
unix:path=/private/tmp/com.apple.launchd.jlwg8wqAzH/unix_domain_listener

But then get the error:

panctl> list-servers
Traceback (most recent call last):
  File "/Users/self/Projects/Vendor/pantalaimon/venv/bin/panctl", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/pantalaimon/panctl.py", line 761, in main
    loop.run_until_complete(panctl.loop())
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 721, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/pantalaimon/panctl.py", line 648, in loop
    self.list_servers()
    ~~~~~~~~~~~~~~~~~^^
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/pantalaimon/panctl.py", line 566, in list_servers
    servers = self.ctl.ListServers()
  File "/Users/self/Projects/Vendor/pantalaimon/venv/lib/python3.13/site-packages/gi/overrides/Gio.py", line 349, in __call__
    result = self.dbus_proxy.call_sync(self.method_name, arg_variant,
                                       kwargs.get('flags', 0),
                                       kwargs.get('timeout', -1),
                                       None)
gi.repository.GLib.GError: g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.pantalaimon1 was not provided by any .service files (2)

So much closer!

@chookity-pokk
Copy link
Collaborator

The pygobject has been updated to a more recent version, and I am currently working on the dbus issue. I also realized ui.py has a bunch of dasbus code in there so I spent time tonight trying to replace that.

I do apologize that I am slow on these responses and fixing the code. It's just been a long couple weeks at work lately.

Also, I'd like the point out that installing via pypi should work just fine for you (hopefully), while I sort this all out.

@RedChops
Copy link
Author

RedChops commented Nov 2, 2024

Not a problem, this is not a mission-critical application for me. I'm happy to keep testing out (and building from a fresh environment) as progress happens. I've been a bit too busy to learn dbus as well or I would have tried to contribute a patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants