Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    <class 'OSError'> Avialable Interfaces are down

    Scheduled Pinned Locked Moved LoPy
    lopy4oserrorlopyinterfaces
    15 Posts 5 Posters 1.4k Views 5 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.
    • robert-hhR Offline
      robert-hh @goro
      last edited by

      @goro Is that all, or dou you have mre information like a line number and/or the respecitive part of the code?

      G 1 Reply Last reply Reply Quote 0
      • M Offline
        Milan
        last edited by Milan

        @goro @robert-hh I'm also getting this error after final line of code:

        import pycom
        import usocket as socket
        
        from network import WLAN
        
        ssidName = 'pycom'
        password = 'pycom123'
        
        wlan = WLAN()
        print("Turning on wlan: " + ssidName)
        wlan.init(mode=WLAN.AP, ssid=ssidName, auth=(WLAN.WPA2, password), hidden=False)
        
        addr = socket.getaddrinfo('0.0.0.0', 80)[0][-1]
        
        OSError: Avialable Interfaces are down
        
        J 1 Reply Last reply Reply Quote 0
        • J Offline
          johand @Milan
          last edited by

          @milan said in <class 'OSError'> Avialable Interfaces are down:

          @goro @robert-hh I'm also getting this error after final line of code:

          wlan.init(mode=WLAN.AP, ssid=ssidName, auth=(WLAN.WPA2, password), hidden=False)
          
          addr = socket.getaddrinfo('0.0.0.0', 80)[0][-1]
          
          OSError: Avialable Interfaces are down
          

          I think you´ll have to wait until the connection is ready.

          wlan.init(mode=WLAN.AP, ssid=ssidName, auth=(WLAN.WPA2, password), hidden=False)
          while not wlan.isconnected():
              pass
          addr = socket.getaddrinfo('0.0.0.0', 80)[0][-1]
          

          Johan

          M 1 Reply Last reply Reply Quote 0
          • M Offline
            Milan @johand
            last edited by

            @johand Thank you for your suggestion. I've tried your code and in that case pycom is stucked in while loop waiting for connection to be ready. I don't know what can be wrong, I'm 100% sure that hardware is ok.

            J 1 Reply Last reply Reply Quote 0
            • J Offline
              johand @Milan
              last edited by

              @milan This is how I usually do to get the correct security settings:

              wlan = WLAN(mode=WLAN.STA)
              nets = wlan.scan()
              for net in nets:
                  if net.ssid == ssidName:
                      print('Network found!')
                      wlan.connect(net.ssid, auth=(net.sec, password), timeout=5000)
                      while not wlan.isconnected():
                          pass
                      break
              

              Johan

              M 1 Reply Last reply Reply Quote 0
              • M Offline
                Milan @johand
                last edited by

                @johand When Pycom is in WiFi STA mode everything works fine, but I want to do the same thing when Pycom is in WiFi AP mode, so other Pycom would be able to connect to AP and to send HTTP request.
                One Pycom should be HTTP server, listening for HTTP requests with WiFi in AP mode, and other should send HTTP requests with WiFi in STA mode connected to first Pycom WiFi.
                Is that even possible?

                J 1 Reply Last reply Reply Quote 0
                • J Offline
                  johand @Milan
                  last edited by

                  @milan said in <class 'OSError'> Avialable Interfaces are down:

                  When Pycom is in WiFi STA mode everything works fine, but I want to do the same thing when Pycom is in WiFi AP mode

                  What problem do you have?

                  It is possible to run one device as HTTP server and one as client. Depending on what you want to transfer, it might be easier to use plain sockets instead.

                  M 1 Reply Last reply Reply Quote 0
                  • M Offline
                    Milan @johand
                    last edited by

                    @johand I want to have one device as HTTP server with WiFi in AP mode, and other device as HTTP client with WiFi in STA mode. HTTP client device should be connected to AP from HTTP server. Is that possible?

                    Are there any example of plain socket communication?

                    Than you in advance.

                    robert-hhR 1 Reply Last reply Reply Quote 0
                    • robert-hhR Offline
                      robert-hh @Milan
                      last edited by robert-hh

                      @milan WiFi connection modes and Client/Server relation are completely independent topics. You can have all devices connected as STA to a separate AP and have a server on one device and clients on all devices.
                      That's something I would do anyhow: Get a unexpensive AP and use that for interconneting, unless you have other restrictions.

                      M 1 Reply Last reply Reply Quote 0
                      • G Offline
                        goro @robert-hh
                        last edited by

                        @robert-hh no, it does not tell me any line or more information, it just shows me that error and continues to execute the code

                        1 Reply Last reply Reply Quote 0
                        • M Offline
                          Milan @robert-hh
                          last edited by

                          @robert-hh Thank you for your suggestion.
                          I've tried configuration with three devices:

                          • device 1 - HTTP client with WiFi in STA mode connected to device 3
                          • device 2 - HTTP server with WiFi in STA mode connected to device 3
                          • device 3 - WiFi in AP mode

                          This configuration works ok.
                          My idea is to have devices 2 and 3 as one device. Is that possible, to have HTTP server which WiFi is in AP mode?

                          J 1 Reply Last reply Reply Quote 0
                          • P Offline
                            pigamonte
                            last edited by

                            @milan
                            I had this exact problem. Roll back to firmware 1.18.0 solved it.

                            1 Reply Last reply Reply Quote 0
                            • J Offline
                              johand @Milan
                              last edited by

                              @milan Yes, as @robert-hh wrote erlier, WIFI mode and what your application does is not related. I guess you have already tried, what problem do you run into?

                              1 Reply Last reply Reply Quote 0
                              • M Offline
                                Milan
                                last edited by

                                @johand After I've set IP for HTTP server

                                wlan.ifconfig(id=1, config=('192.168.4.10', '255.255.255.0', '192.168.4.1', '192.168.4.1'))
                                

                                i've tried to read IP address of HTTP Server and that was the problem, it's keep returning me '0.0.0.0'. IP address was set properly to '192.168.4.10' but function returns '0.0.0.0'.

                                print('Network config:', wlan.ifconfig())
                                Network config: ('0.0.0.0', '0.0.0.0', '0.0.0.0', '0.0.0.0')
                                

                                Thank you for your help.

                                @pigamonte I've managed to do it with 1.18.2.

                                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
                                • 1 / 1
                                • First post
                                  Last post

                                Pycom on Twitter

                                Pycom