OSError: [Errno 1] EPERM connecting to WLAN on Raspberry Pi Pico W

62 Views Asked by At

OSError: [Errno 1] EPERM how to solve this error whenever i try to connect wifi this error arrives

i need to solve this error and connect my pico w to wifi. when ever i upload the code using thonny and selected micropython pico and run the code but it showing in the wlan connect line. my code:

import network
import time
ssid = 'xxxxxx'
password = 'xxxxxx'
import urequests
def connect_Wifi(s,b):
    #Connect to WLAN
    wlan = network.WLAN(network.STA_IF)
    wlan.active(True)
    wlan.connect(s,b)
    wait = 10
    while wait>0:
        if wlan.status()<0 or wlan.status() >= 3:
            break
        wait -=1
        print('Waiting for connection...')
        time.sleep(1)
    if wlan.status()!=3:
        raise RuntimeError('Wifi connection failed')
    else:
        ip = wlan.ifconfig()[0]
        print(f'Connected on {ip}',ip)
        return ip
connect_Wifi(ssid,password)
0

There are 0 best solutions below