Sample Python scripts

The ‘Digi Python Programming Guide’ states on page 33 that there are several sample Python programs included on the Software and Documentation CD. These samples should be included in the map ‘Python/Samples/’ on the CD but I cannot find them. Maybe I have an old CD.

Can somebody send me the files? I cannot find them on the FTP support site either. Please respond in this topic.

Thanks in advance,

Eelke

Hi
I’ve got connectport X2 and 2 endpoints (znet2.5 router/end device xbp24-b firmware version 1241 on both, but one is connected via usb and the other via rs232). I loaded some of the samples in the drop in networking cd (zb_ex2_rw.py, zb_ex3_nbio.py and zb_x4_disc.py) to my gateway but couldnt manage to run 2 of these samples properly. zb_x4_disc.py worked fine, zb_ex3_nbio.py did nothing, and zb_ex2_rw.py gave me the following error:
Traceback :
File “”, line 16, in ?
File “”, line 1, in bind
socket.error: <22, ‘invalid argument’>
Can someone tell me how to fix this please?

Digi-provided python examples can be found here:

http://www.digi.com/wiki/developer/index.php/Python_Wiki
http://www.digi.com/support/productdetl.jsp?pid=3723&amp;osvid=0&amp;tp=7
http://www.digi.com/support/kbase/kbaseresultdetl.jsp?id=3063
http://www.idigi.com/resources.jsp

Thank you for your answer. However, I cannot find the samples mentioned on the Python Digi Wiki and in the documentation (http://ftp1.digi.com/support/documentation/90000833_b.pdf).

To be more precise, I would like to have the following two demos:

  • The GPS demo in the Python/Samples/gps directory on the Software and Documentation CD

  • The port sharing demo program in Python/Samples/sharing

Can you provide me with a link to this samples?

Thanks in advance!

Here you go.

Thank you very much for the files. I have added them to the Python Digi Wiki (http://www.digi.com/wiki/developer/index.php/Digi_Python_Programmer's_Guide#Sample_Programs).

Thanks for adding those emtoonst.

To be thorough, attached to this post are the other script samples which were on the DiN CD. These being the hello world, read/write, non-blocking I/O, and node discovery scripts, as well as the “zigbee.py” that came on the CD.

The Embedded Kit Gateway Viewer app (and source) can be obtained via the following article in our knowledgebase:
http://www.digi.com/support/kbase/kbaseresultdetl.jsp?id=3063

I’ve also moved this thread to the proper forum.

Maybe you could try to get the ‘Hello World’ example working:

http://www.digi.com/wiki/developer/index.php/Zigbee_Extensions_to_the_Python_socket_API#Send_.E2.80.9CHello.2C_World.21.E2.80.9D

This uses the same sd.bind((“”, 0xe8, 0, 0)) command and thats where it goes wrong in your case.

I’ve tried that and it gives me the following error:
Traceback :
File “”, line 16, in ?
File “”, line 1, in bind
socket.error: <22, ‘invalid argument’>

I’m really new to this and i’m not too sure what i’m doing wrong, but if i have two endpoints each connected to a pc, and i wanted to send data between them, what application would i use to do this. I know XCTU is used to configure the modem, and telnet or web UI is used for the gateway, but i dont know what application i should use to communicate two pc’s with each other. I want to see whatever i type on 1 pc to appear on the other and vice versa.

I understand that the hello world program sends “Hello, World!” using the Digi proprietary mesh transport to a fixed node address, but how would i be able to see this in that particular node address? what application do i use?

You could use Hyperterminal, this comes with Windows XP.

Ok i’ve set that up on both pc’s and tried running the “hello world” program again, but i get the following error:
Traceback :
File “”, line 23, in ?
File “”, line 1, in bind
socket.error: <22, ‘invalid argument’>

i then realised that on both pc’s, XCTU is unable to open com port. This happened after i set up hyperterminal. I downloaded xctu on both pc’s and i set the hyperterminal to their respective com ports that their xctu uses. Is this correct? Can you tell me where i went wrong? Sorry, i havent used hyperterminal before.

You get socket.error: <22, ‘invalid argument’> all the time, so focus on that. This has nothing to do with hyperterminal or anything else. Get your script working without the socket.error: <22, ‘invalid argument’>.

Your script is not working because you have a another script running and using the same endpoint you are attempting to bind to.

Navigate to your ConnectPort’s WebUI, click on Applications->Python->Auto-start Settings, uncheck whichever script may be set to autorun, click Apply and reboot your gateway.

Finally, give your script another try!

Jordan

ok so i’ve come back this morning, connected everything up again as before and checked the gateway for any auto-start settings but there’s nothing there. So i attempted to run the program again, i think this time it works because it doesnt give me any errors, but i am not able to see “hello world” on the other pc. I’ve got the hyperterminal set up and open but nothing happens on that pc. Am i suppose to configure anything else on that pc/endpoint that i’m trying to send to? Help please!!