← index #15117Issue #14408
Off-topic · high · value 2.311
QUERY · ISSUE

os.rmdir() deletes files

openby massimosalaopened 2024-05-25updated 2024-05-30
bugextmod

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.

CANDIDATE · ISSUE

Pico W:when I try "wlan.connect()" and "wlan.scan()" ,I get an "OSError: [Errno 1] EPERM"

closedby letr007opened 2024-05-02updated 2024-05-02
bug

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.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied