os.rmdir() deletes files
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
rp2, esp32, esp8266
MicroPython version
Micropython 1.22.2
Reproduction
open("prova.tmp", 'w').write('1')
1
import os
os.rmdir("prova.tmp")
open("prova.tmp", 'r')
Expected behaviour
rmdir() should raise OSError
Regular Python raises NotADirectoryError
Observed behaviour
rmdir() succeeds and the file is deleted.
open("prova.tmp", 'r')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 2] ENOENT
Additional Information
No, I've provided everything above.
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.