ZBS_PROT_TRANSPORT is not defined

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|_____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
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.
Version:
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.

rgds,
sharbt

You do need to have zigbee.py and python.zip installed as this is where your imports come from.

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
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?

rgds,
Sharbt

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
sys.path.append(“WEB/Python/Python.zip”)
"

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 ’
'.join(sys.path)

/usr/lib/python27.zip
/usr/lib/python2.7
/usr/lib/python2.7/plat-linux2
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/lib/python2.7/site-packages

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
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.

https://www.digi.com/resources/documentation/digidocs/90001537/default.htm

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