🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    microWebSrv2 on M5atom lite with micropython

    Scheduled Pinned Locked Moved SOFTWARE
    2 Posts 2 Posters 4.3k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E Offline
      Eriks
      last edited by

      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:

      /ConnectWiFi.py
      /MicroWebSrv2/init.py
      /MicroWebSrv2/httpRequest.py
      /MicroWebSrv2/httpResponse.py
      /MicroWebSrv2/libs/XAsyncSockets.py
      /MicroWebSrv2/libs/XAsyncSocktes.py
      /MicroWebSrv2/libs/urlUtils.py
      /MicroWebSrv2/microWebSrv2.py
      /MicroWebSrv2/mods/PyhtmlTemplate.py
      /MicroWebSrv2/mods/WebSockets.py
      /MicroWebSrv2/webRoute.py
      /SSL-Cert/openhc2.crt
      /SSL-Cert/openhc2.key
      /boot.py
      /img/microWebSrv2.png
      /lib/urequests.py
      /main.py
      /www/favicon.ico
      /www/index.html
      /www/pdf.png
      /www/style.css
      /www/test.pyhtml
      /www/wschat.html
      /www/wstest.html

      And run into this error when booting:

      Connection successful
      ('192.168.1.46', '255.255.255.0', '192.168.1.1', '192.168.1.1')
      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:
      # ------------------------------------------------------------------------

      @staticmethod
      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)
      
      1 Reply Last reply Reply Quote 0
      • R Offline
        robalstona
        last edited by robalstona

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

        Instead:

         ('mods.%s' % modName)
        

        i think it should be:

        ('mods/%s' % modName)
        

        or

        ('mods\\%s' % modName)
        
        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post