Home/Support/Support Forum/ZBS_PROT_TRANSPORT is not defined
New and improved user forum site going live on 12/6 (All users will need to reset their password when the new forum is active)
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

ZBS_PROT_TRANSPORT is not defined

0 votes
Hi members,
I am using https://www.digi.com/resources/documentation/digidocs/90001537/default.htm#references/r_tcp_to_zigbee_dynamic.htm%3FTocPath%3DData%2520Tunneling%7C_____1
example for zigbee-tcp data tunnelling on Xbee gateway. But the python fails while running.

/userfs/WEB/python $ python tcp_zig_dynamic_mapping.py
name 'zigbee' is not defined
Failed to retrieve hardware version from local radio
Assuming it's a series 1 device
Traceback (most recent call last):
File "tcp_zig_dynamic_mapping.py", line 125, in <module>
zig_sock = socket(socket.AF_ZIGBEE, socket.SOCK_DGRAM, ZBS_PROT_TRANSPORT)
NameError: name 'ZBS_PROT_TRANSPORT' is not defined

Have done all recommendations but still no luck.
Python 2.7.1 (r271:86832, Jul 28 2017, 00:19:06)
[GCC 4.4.6] on linux2

Can someone guide if any in-built or digi python module needs to be changed.

asked Sep 17, 2020 in 3rd Party Python and API development in other Languages by SharBT New to the Community (2 points)

Please log in or register to answer this question.

1 Answer

0 votes
You do need to have zigbee.py and python.zip installed as this is where your imports come from.
answered Sep 17, 2020 by mvut Veteran of the Digi Community (15,515 points)
Thanks for the same.
Did not include zigbee.py but error shifted to bit earlier itself.

Traceback (most recent call last):
  File "tcp_zig_dynamic_mapping.py", line 125, in <module>
    zig_sock = socket(socket.AF_ZIGBEE, socket.SOCK_DGRAM, ZBS_PROT_TRANSPORT)
AttributeError: 'module' object has no attribute 'AF_ZIGBEE'

And , excluded socket.py and error again shifter to earlier meaning both socket and zigbee modules are needed.
Is there any reason python.zip might be corrupted or need to be reinstalled and any ways to do that?

You are probably going to need to replace your Python.zip file
Thanks but still the issue . Downloaded and copied latest Python.zip file as explained in https://www.digi.com/resources/documentation/digidocs/90001537/references/r_loading_python_programs_to_digi_device.htm .It seems is all pre-loaded but latest can still be tried.
Did you copy the example completely or did you do something else?
Steps performed (BusyBox v1.20.2)
-Download python.zip(actually renaming downloaded folder)
-Copying over "/userfs/WEB/python"
-Python tcp_zig_dynamic_mapping.py (same error as above)
-This was done after reboot etc.
And with change
"import sys,zipimport
That was not what I was meaning. What I am referring to is if you are Copying the example code directly or are you doing something else?
No it is the same as example.
Other file in example is run correctly

/userfs/WEB/python $ python table_namer.py
wrote 1 entries

Checking library paths:

>>> import sys
>>> print '\n'.join(sys.path)


Am newbie to python but have added the Python.zip in the session(code).
I think I see the issue. The line should only be:

zig_sock = socket(socket.AF_ZIGBEE)
Thanks , but seems did not help and threw different error.

/userfs/WEB/python $ python tcp_zig_dynamic_mapping.py
Detected Series 2 radio in gateway, configuring zigbee socket appropriately
Traceback (most recent call last):
  File "tcp_zig_dynamic_mapping.py", line 128, in <module>
    zig_sock = socket.socket(socket.AF_ZIGBEE)
  File "/usr/lib/python2.7/socket.py", line 187, in __init__
  File "usr/lib/python2.7/site-packages/xbee_socket_hal.py", line 107, in __new__
socket.error: [Errno 0] Error

Is there something I can find working examples which is tried on Xbee Industrial Gateways?
By all means.


The default application or XIG will take data from a router or end point and send it to the Digi Remote manager.