Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot find reference to 'STA_IF' in 'network.pyi' #241

Open
waanito opened this issue Jul 14, 2023 · 3 comments
Open

cannot find reference to 'STA_IF' in 'network.pyi' #241

waanito opened this issue Jul 14, 2023 · 3 comments

Comments

@waanito
Copy link

waanito commented Jul 14, 2023

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.

@waanito waanito changed the title cannot find reference to 'STA_IF' in 'netwrok.pyi' cannot find reference to 'STA_IF' in 'network.pyi' Jul 14, 2023
@waanito
Copy link
Author

waanito commented Jul 17, 2023

Screen Shot 2023-07-17 at 1 27 17 PM

@andreluisos
Copy link

Same issue. Have you figured it out, @waanito ?

@acloaf
Copy link

acloaf commented Mar 25, 2024

Following up to see if there is a resolution for this, I am also experiencing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants