Skip to content

When is a string not a string? Problems with the config method on network interfaces. #3442

@larsks

Description

@larsks

I'm running MicroPython v1.9.3-8-g63826ac5c on an esp8266.

Given:

>>> ap_if = network.WLAN(network.AP_IF)

This works:

>>> ap_if.config('essid')
'MicroPython-35a0d8'

And this works:

>>> key = 'essid'
>>> ap_if.config(key)
'MicroPython-35a0d8'

But this fails:

>>> key1 = 'essid'
>>> ap_if.config(key1)
'MicroPython-35a0d8'
>>> somevar = b'essid'
>>> key2 = str(somevar, 'ascii')
>>> ap_if.config(key2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: unknown config param

Even though:

>>> type(key1) == type(key2)
True
>>> key1 == key2
True
>>> repr(key1) == repr(key2)
True

What's going on here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions