microWebSrv2 on M5atom lite with micropython

  • I'm trying to install the web server microWebSrv2 on a M5atom lite.
    github microWebSrv2

    Has anyone done this before without freezing?
    Would be grateful for any hint.

    I copied the files with ampy to the m5atom lite, here is the file structure on the M5atom lite:


    And run into this error when booting:

    Connection successful
    ('', '', '', '')
    running on M5atom lite

       - Python pkg MicroWebSrv2 -
       -      version 2.0.6      -
       -     by JC`zic & HC2     -

    I (6206) modsocket: Initializing

    • [@WebRoute] GET /test-redir
    • [@WebRoute] GET /test-post (TestPost1/2)
    • [@WebRoute] POST /test-post (TestPost2/2)

    Traceback (most recent call last):
    File "main.py", line 153, in <module>
    File "MicroWebSrv2/microWebSrv2.py", line 136, in LoadModule
    MicroWebSrv2Exception: Cannot load module "WebSockets".
    MicroPython v1.13 on 2020-09-02; TinyPICO with ESP32-PICO-D4
    Type "help()" for more information.

    this is raised by this code in MicroWebSrv2/microWebSrv2.py:
    # ------------------------------------------------------------------------

    def LoadModule(modName) :
        if not isinstance(modName, str) or len(modName) == 0 :
            raise ValueError('"modName" must be a not empty string.')
        if modName in MicroWebSrv2._modules :
            raise MicroWebSrv2Exception('Module "%s" is already loaded.' % modName)
        try :
            modPath  = MicroWebSrv2.__module__.split('microWebSrv2')[0] \
                     + ('mods.%s' % modName)
            module   = getattr(__import__(modPath).mods, modName)
            modClass = getattr(module, modName)
            if type(modClass) is not type :
                raise Exception
            modInstance = modClass()
            MicroWebSrv2._modules[modName] = modInstance
            return modInstance
        except :
            raise MicroWebSrv2Exception('Cannot load module "%s".' % modName)

  • It's probably a typo. I think there should be a / on the line instead of .


     ('mods.%s' % modName)

    i think it should be:

    ('mods/%s' % modName)


    ('mods\\%s' % modName)