liamw9534 / pyconnman Goto Github PK
View Code? Open in Web Editor NEWA library for managing network connectivity using Python, ConnMan and DBus
License: Apache License 2.0
A library for managing network connectivity using Python, ConnMan and DBus
License: Apache License 2.0
Hello, I am facing an issue when running pyconnman demo example.
Error ( With try catch block in demo.py at service_connect() function ) :-
Unable to complete: (<class 'dbus.exceptions.DBusException'>,
DBusException('Did not receive a reply. Possible causes include: the remote application
did not send a reply, the message bus security policy blocked the reply, the reply
timeout expired, or the network connection was broken.',), <traceback object at 0xb6002b70>)
Error ( Without try catch block in demo.py at service_connect() function ) :-
63686e6f6c6f67696573_managed_psk
Traceback (most recent call last):
File "demo.py", line 360, in <module>
invoke_command(text)
File "demo.py", line 325, in invoke_command
cmd_entry.func(args)
File "demo.py", line 130, in service_connect
service.connect()
File "/home/debian/.local/lib/python2.7/site-packages/pyconnman/service.py", line 423, in connect
return self._interface.Connect()
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
**keywords)
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a
reply. Possible causes include: the remote application did not send a reply, the message
bus security policy blocked the reply, the reply timeout expired, or the network connection
was broken.
Steps I am following are:-
~ python demo.py
CONN> technology-scan /net/connman/technology/wifi
=========================================================
>>>>> ServicesChanged <<<<<
(None, dbus.Array([dbus.Struct((dbus.ObjectPath('/net/connman/service/ethernet_b827ebaf24d8_cable'),
dbus.Dictionary({}, signature=dbus.Signature('sv'))), signature=None),......
CONN> list-services
=========================================================
/net/connman/service/wifi_000f1330203f_4254487562352d4e473657_managed_psk [BTHub5-NG6W]
/net/connman/service/wifi_000f1330203f_4254576946692d776974682d464f4e_managed_none [BTWiFi-with-FON]
/net/connman/service/wifi_000f1330203f_544e434150374345434535_managed_psk [TNCAP7CECE5]
/net/connman/service/wifi_000f1330203f_4449524543542d376b5b54565d55453430455337303030_managed_psk [DIRECT-7k[TV]UE40ES7000]
CONN> agent-start /test/agent ssid=BTHub5-NG6W passphrase=secret123
CONN> service-connect /net/connman/service/wifi_000f1330203f_4254487562352d4e473657_managed_psk
#At this point it's throwing the error mentioned above.
For *A
Situation as shown below
*A BTHub5-NG6W wifi_000f1330203f_4254487562352d4e473657_managed_psk
Where the connection has already been established previously It's working for the Python Demo Script.
It's throwing the error for establishing a new connection.
Also When I use connmanctl for the Same network it's working without any problem.
The version of pyconnman hosted on PyPI does not contain the latest fixes. Most notably the dependency on python-dbus is missing.
Hi,
For a project I would like to use pyconnman to read and write the Ethernet properties.
On this moment I am able to read the properties with pyconnman, but I am not able to write new values.
For example how can I change the Gateway and IP address of an IPv4 connection?
The current code I tried is:
service = pyconnman.service.ConnService('/net/connman/service/ethernet_00142d63183c_cable')
ip = service.get_property('IPv4')
ip_conf = service.get_property('IPv4.Configuration')
print(service.get_property('IPv4'))
ip.update({dbus.String('Gateway'): dbus.String('192.168.10.222')})
ip_conf.update({dbus.String('Gateway'): dbus.String('192.168.10.222')})
ip_conf.update({dbus.String('Address'): dbus.String('192.168.10.240')})
ip.update({dbus.String('Address'): dbus.String('192.168.10.240')})
But this has no effect on the Ethernet properties. When I check with connmanctl the properties are not affected.
Thank you in advance for your help.
Best regards,
Gerard
Hi,
are you gonna make a release on pypi to include the python3 support?
Cheers
Nick
I'm running into an issue when using the demo.py example or my own script and connecting to a wifi network for the first time. For example:
CONN> list-services
CONN> agent-start /test/agent ssid=myNetwork passphrase=myPassphrase
CONN> service-connect /net/connman/service/wifi_xxxxx__managed_psk
This eventually results in an error:
Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken
However, if I use connmanctl to manually connect at least once, it does work. For example:
connmanctl
connmanctl> agent on
connmanctl> connect wifi_xxxxx__managed_psk
Agent RequestInput wifi_xxxxx__managed_psk
Passphrase = [ Type=psk, Requirement=mandatory ]
Passphrase? myPassword
connmanctl> Connected wifi_xxxxx__managed_psk
Now it will connect, and I can use the same demo.py script to disconnect or reconnect. But for any new wifi network, I have to use connmanctl first (which creates the /var/lib/connman/wifi* folder with the saved settings)
Any idea why this would be the case and how I might get around the problem?
I've been trying to resurrect this code and I'm having trouble using the agent to get WPA connections working. I've been able to successfully use the node.js version of connman so I know it's not the network. I'm getting an Invalid Arguments as described here: https://github.com/liamw9534/pyconnman/blob/master/pyconnman/service.py#L421, but I don't know what arguments would be invalid. I've logged just about everything and when a Passcode is requested, it properly responds with the correct passcode, it just seems to be in an invalid format. Any thoughts or advice would be much appreciated!
When installing via pip, I need to also install dbus-python or I cannot import pyconnman. It would be convenient to just add that dependency in setup.py
. I can make a pull request if you like.
>>> import pyconnman
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/jbronder/st/cmtui/.venv-3.9.2/lib/python3.9/site-packages/pyconnman/__init__.py", line 5, in <module>
from pyconnman.exceptions import * # noqa
File "/home/jbronder/st/cmtui/.venv-3.9.2/lib/python3.9/site-packages/pyconnman/exceptions.py", line 4, in <module>
import dbus
ModuleNotFoundError: No module named 'dbus'
>>>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.