python-sdbus / python-sdbus-networkmanager

python-sdbus binds for NetworkManager
GNU Lesser General Public License v2.1
30 stars 6 forks source link

NetworkManagerConnectionProperties is missing on add-wifi-psk-connection.py #45

Closed zlinuxboy closed 2 years ago

zlinuxboy commented 2 years ago

I am newbie in programming, want to utilize sdbus to manipulate wifi connection for a project, finally find your project. It's awesome, really. I am trying to figure out how python-sdbus-networkmanager works, when running example/sd_block/add-wifi-psk-connection.py, there is an error emitted:

Traceback (most recent call last):
  File "/home/rui/wireless/src/learn-pysdbus/python-sdbus-networkmanager/examples/block/add-wifi-psk-connection.py", line 54, in <module>
    from sdbus_block.networkmanager import NetworkManagerConnectionProperties
ImportError: cannot import name 'NetworkManagerConnectionProperties' from 'sdbus_block.networkmanager' (/home/rui/wireless/lib/python3.10/site-packages/sdbus_block/networkmanager/__init__.py)

My questions are:

  1. is that a bug and how to fix it?
  2. any plan to write a binding for wpa_supplicant dbus api?
  3. how is your developing progress of binding for systemd?
zlinuxboy commented 2 years ago

list-connections.py has similar problem, ConnectionType Can not be imported. but device-state.py is working well.

(wireless) rui@odc2-1 ~/w/s/l/p/e/block (master)> python list-connections.py
Traceback (most recent call last):
  File "/home/rui/wireless/src/learn-pysdbus/python-sdbus-networkmanager/examples/block/list-connections.py", line 19, in <module>
    from sdbus_block.networkmanager import (
ImportError: cannot import name 'ConnectionType' from 'sdbus_block.networkmanager' (/home/rui/wireless/lib/python3.10/site-packages/sdbus_block/networkmanager/__init__.py)
(wireless) rui@odc2-1 ~/w/s/l/p/e/block (master) [0|1]> python device-state.py
Interface         Type     State        Internet Connection
lo                Generic  Unmanaged    Unknown
eth0              Ethernet Unmanaged    Unknown
usb_wifi1         Wifi     Activated    Limited  wlusb1
usb_wifi2         Wifi     Activated    Limited  wlusb2
p2p-dev-usb_wifi1 Wifi_P2P Disconnected None
p2p-dev-usb_wifi2 Wifi_P2P Disconnected None
wlvrf1            Vrf      Activated    Limited  wlvrf1
wlvrf2            Vrf      Activated    Limited  wlvrf2
igo95862 commented 2 years ago

Hello,

Did you use the PyPI version of python-sdbus-networkmanager? It is still version 1.1

The examples use the latest master (and eventual version 2.0).

igo95862 commented 2 years ago

any plan to write a binding for wpa_supplicant dbus api? how is your developing progress of binding for systemd?

Eventually, or someone else can create them. I don't have much time currently to work on them. There is network manager binds version 2 and BlueZ binds that need to be released first.

zlinuxboy commented 2 years ago

Indeed, you are right, after install sdbus and sdbus-networkmanager with master. the example code work flawless. but the sdbus-networkmanager version is 1.2, not 2.0 as you mention above.

zlinuxboy commented 2 years ago

issue close

igo95862 commented 2 years ago

but the sdbus-networkmanager version is 1.2

The original plan was to add the settings classes and release 1.2 but there had been some incompatible changes so the next version will be 2.0