namedtuple does not support "defaults" keyword argument
Checks
-
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
-
I've searched for existing issues matching this bug, and didn't find any.
Port, board and/or hardware
Pico W (RP2040)
MicroPython version
MicroPython v1.22.2 on 2024-02-22; Raspberry Pi Pico W with RP2040
Reproduction
>>> from collections import namedtuple
>>> namedtuple('a', ['a'], defaults=[1])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: function doesn't take keyword arguments
Expected behaviour
Expected the creation of a NamedTuple with defaults.
Observed behaviour
Exception as shown in repro code.
Additional Information
The keyword-only argument of defaults was added in Python 3.7 according to the Python docs. I could not find any mention of this change or disparity in the MicroPython docs.
I did, however, find that the change to other arguments becoming keyword-only in Python 3.6 is not listed as implemented in the MicroPython docs.
It seems like the lack of keyword argument support might be intentional - I'm not sure if this means it should be considered a feature request and/or docs improvement instead?
Pico W:when I try "wlan.connect()" and "wlan.scan()" ,I get an "OSError: [Errno 1] EPERM"
Checks
-
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
-
I've searched for existing issues matching this bug, and didn't find any.
Port, board and/or hardware
raspberry pico w with rp2040
MicroPython version
MicroPython v1.19.1-88-g74e33e714 on 2022-06-30; Raspberry Pi Pico W with RP2040
MicroPython v1.22.1 on 2024-01-05; Raspberry Pi Pico W with RP2040
Reproduction
import network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(BSSID, pwd)
Expected behaviour
No response
Observed behaviour
Traceback (most recent call last):
File "<stdin>", line 169, in handle_key
File "<stdin>", line 152, in menu_wifi
File "<stdin>", line 120, in wlan_connect
OSError: [Errno 1] EPERM
Additional Information
I've looked for a solution to a similar problem, but it doesn't help me.
I tried "micropython.alloc_emergency_exception_buf(100)" by ChatGPT, but it didn't work.