frozen AWS MQTT



  • I started working with AWS based on the example in the docs https://docs.pycom.io/tutorials/all/aws.html .
    There were some really strange effects until I found out that on my device (Pycom MicroPython 1.18.1.r1 [v1.8.6-849-b0520f1] on 2018-08-29; WiPy with ESP32) the downloaded AWSIoTPythonSDK is not used at all - when doing an "import MQTTLib", python seems to load the builtin frozen module, which is rather confusing.

    • How do I see which modules are builtin? dir() does not list frozen modules it seems.

    • How do I best get rid of the builtin module (without compiling the firmware)? Rename all references in the MQTT source files manually?

    • What is the latest recommended source for AWS IoT access? It seems https://github.com/pycom/pycom-micropython-sigfox/tree/master/esp32/frozen/Common is included as frozen, not the example from the documentation reference.

    Please update the documentation!



  • @martinnn said in frozen AWS MQTT:

    @robertkeizer What do you mean by 'relative path'? The import statement is

    from MQTTLib import AWSIoTMQTTClient

    How do you point this to another source?

    I added my own copy of the library in the directory AWSIoTPythonSDK, and then was able to use from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTShadowClient or similar.

    Effectively just add your own copy of the library and then use a from xx import ; As long as you don't use the exact same name as the default one, and the directory exists in /lib you should be able to use another version.



  • @martinnn said in frozen AWS MQTT:

    How do I see which modules are builtin?

    The frozen bytecode module are all contained under the path https://github.com/pycom/pycom-micropython-sigfox/tree/master/esp32/frozen and its subdirectories. In version 1.20.0.rc4, you can also call
    help('modules')
    to get a list of all built-in modules including the frozen ones.

    How do I best get rid of the builtin module (without compiling the firmware)? Rename all references in the MQTT source files manually?

    You can alway rename a module during import like:
    import module_name as alias
    That may save some work.



  • @robertkeizer What do you mean by 'relative path'? The import statement is

    from MQTTLib import AWSIoTMQTTClient

    How do you point this to another source?



  • I found that if you use a relative path, the micropython interpreter will use the one you specify, not the built in.



  • OK...
    what about the other issues dir(frozen modules)? How to override the builtin frozen MQTT client?



  • Heya,

    Thanks for pointing out the error in the docs. I know someone is currently working (Litterally today) on updating all the AWS / MQTT libs ready for a future RC build.

    Ill work with them to get the docs ammended at the same time.


Log in to reply
 

Pycom on Twitter