environment:
macos; pycharm professional 2023.1.3 & 4; esp32 devkit1 attached as /dev/cu.SLAB_USBtoUART; micropython plugin installed; micropython esp8266 selected in languages.
trying to connect to wifi works fine from REPL in PyCharm when entered directly in REPL after ESP32 is erased then flashed with micropython but as soon as I write a simple main as below in PyCharm to connect it brings up the error in the title. Same code works fine in two other IDEs tried...
import network
from time import sleep
def getwifi():
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.connect('AP_name', 'AP_password')
while not sta_if.isconnected():
pass
sleep(2)
print('network config:', sta_if.ifconfig())
sta_if.active(False)
print('network config:', sta_if.ifconfig())
if __name__ == '__main__':
getwifi()
inspection of micropython.network.pyi shows the only reference to STA_IF within comments suggesting code like above.
inspection of esp8266.network.pyi shows STA_IF defined.
FWIW attempted workaround by copying 'esp8266.network.pyi' to a user module and importing gets past the title error but produces a new error that 'typing' is not defined.
environment: macos; pycharm professional 2023.1.3 & 4; esp32 devkit1 attached as /dev/cu.SLAB_USBtoUART; micropython plugin installed; micropython esp8266 selected in languages.
trying to connect to wifi works fine from REPL in PyCharm when entered directly in REPL after ESP32 is erased then flashed with micropython but as soon as I write a simple main as below in PyCharm to connect it brings up the error in the title. Same code works fine in two other IDEs tried...
inspection of micropython.network.pyi shows the only reference to STA_IF within comments suggesting code like above. inspection of esp8266.network.pyi shows STA_IF defined. FWIW attempted workaround by copying 'esp8266.network.pyi' to a user module and importing gets past the title error but produces a new error that 'typing' is not defined.