I am new to Python. I try to run the sample python ZigBee scripts on a Digi gateway and have run into issues. All the sample programs which uses bind() fails with “Invalid Argument”. Looks like even the published Digi documentation does not discuss the syntax of bind(). Will any of you able to help he towards the right direction
The most common “Invalid Argument” failure in conjunction with “bind” is an attempt to re-use a “port” that is already in use.
If you are attempting to execute scripts interactively via the Digi CLI, please determine whether other Python scripts are already running. The Digi CLI “who” command can be used to query the system for active Python scripts.
It is often the case that there is a script automatically running at startup that is “consuming” the port you wish to bind to. Examining the “set python” information in the CLI could be helpful as well.
Thank you. Yes it was due to a autostart script zb_tcp_serial.py which is coming default with the gateway. It seems like it has already bind with the “port”
I’m getting the bind error quite frequently on the ConnectPortX2 when executing the following code snippet
[pre]
self.socket = socket(AF_ZIGBEE, SOCK_DGRAM, ZBS_PROT_TRANSPORT)
self.socket.bind((“”, 0xe8, 0, 0))
[…]
#> python monitor.py
Traceback (most recent call last):
File “”, line 474, in ?
File “”, line 262, in init
File “”, line 1, in bind
socket.error: (22, ‘Invalid argument’)
[/pre]
I’m confident that nothing else is running, for example, here’s the CLI ‘who’ output immediately after getting the above bind error:
[pre]
#> who
ID From To Protocol Sessions
1 10.0.70.6 local shell telnet
[/pre]
Bizarrely, if I run the program 2 or 3 times in a row, it will frequently work fine after initially throwing the socket error.
Any ideas? This is preventing my code from starting reliably in “run on boot” mode (currently deactivated).