Wemos D1 Mini 4MB file read: OSError: [Errno 13] EACCES

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
flokstra
Posts: 2
Joined: Tue Apr 02, 2019 1:12 pm

Wemos D1 Mini 4MB file read: OSError: [Errno 13] EACCES

Post by flokstra » Tue Apr 02, 2019 3:24 pm

Hi there fellow micro-pythonians!

First of all, hats off to the micropython team! Great piece of kit!

But still, i'f got a problem....
I'm writing a custom module incorporating the urequests module. Urequest runs but hangs on line 20: self._cached = self.raw.read()

After that ran a little test but ran into a Errno 13 (implying permission denied):

[code]
MicroPython v1.10-8-g8b7039d7d on 2019-01-26; ESP module with ESP8266
Type "help()" for more information.
>>> import uos
>>> uos.listdir()
['boot.py']
>>> f = open("test.txt", "w")
>>> f.write("this is a test")
14
>>> f.read()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 13] EACCES
>>> uos.listdir()
['boot.py', 'test.txt']
>>>
[/code]

Open and write work, read get's errno 13. I tried this with the ESP8266 stable, nightly and my custom builds. In between firmware uploads, the flash is always cleared.

Can any of you maybe reproduce? I'm running a Wemos D1 Mini 4Mb with latest MP 1.10.
I will try to reproduce it myself on another board tonight!

Many thanks already for any help given!

User avatar
Roberthh
Posts: 1569
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Wemos D1 Mini 4MB file read: OSError: [Errno 13] EACCES

Post by Roberthh » Tue Apr 02, 2019 4:17 pm

You have to open the file for both reading an writing, like:
f.open("file.txt", "w+")
and before reading, you have to go back to start, like with:
f.seek(0)

These are standard file operation properties, nothing special to MicroPython.
And yes, don't forget to close the file with:
f.close()
Otherwise the data may not be written.

flokstra
Posts: 2
Joined: Tue Apr 02, 2019 1:12 pm

Re: Wemos D1 Mini 4MB file read: OSError: [Errno 13] EACCES

Post by flokstra » Tue Apr 02, 2019 4:33 pm

Consider this as my facepalm. I guess i needed the extra set of eyes to state the obvious... Thanks!

Post Reply