"from typing import" doesn't work

I’ve seen sample code from Digi using typing.
Running the build on PyCharms works, but when running on the XBee it raises the following error:

ImportError: no module named ‘typing’

Product family: XB3-24
Function set: Digi XBee3 Zigbee 3.0 TH
Firmware version: 1010

1 Like

I would suggest looking thru https://www.digi.com/resources/documentation/digidocs/90002219/default.htm

I’ve posted a very specific problem and you’ve pointed me to the root of the manual. That is far from helpful.
I can see from micropython.org that ‘typing’ is not there.

But then again, Digi own samples use it.
I want to confirm if Digi samples are broken or if the package ‘typing’ isn’t really available.

1 Like

Hi Esimioni,

yes Eric’s comment is very unhelpful but the real answer is not much better however not Digi’s fault.

Typing does not appear to be implemented in micropython.

https://github.com/micropython/micropython-lib/issues/190

Can you link to where Digi use it in the samples?

If you are referring to the typing references here:
https://www.google.com/search?q=site%3Ahttps%3A%2F%2Fgithub.com%2Fdigidotcom%2Fxbee-micropython+“typing”

Then these are simply used for typehints.

typehints - This folder contains the API definitions of the MicroPython modules available in the XBee devices. These definitions are used by the Digi XBee MicroPython PyCharm Plugin for syntax checking, code completion and refactoring.

Basically, it is just for PyCharm support not for micropython itself.

Regards,

Nicholas Wilson

Your IoT
Creating your Internet of Things
https://www.YourIoT.com.au

Thanks Nicholas!
Indeed the only sample files using typing are the API definitions.