SD Card, can't write from another module or async tasks.

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
prem111
Posts: 58
Joined: Sun Feb 23, 2020 3:18 pm

SD Card, can't write from another module or async tasks.

Post by prem111 » Tue May 26, 2020 9:37 pm

Why when I mount the SD in start boot.py or main.py I can't write to a file from another module or from task async? Do I have to grant any permissions?

main.py

Code: Select all

import os
import machine
os.mount(machine.SDCard(slot=3,width=4), "/sd")

User avatar
dhylands
Posts: 3385
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: SD Card, can't write from another module or async tasks.

Post by dhylands » Tue May 26, 2020 10:38 pm

You should be able to. Make sure you're using a filename like "/sd/filename.txt" (it's the /sd part that's important, not the filename)

prem111
Posts: 58
Joined: Sun Feb 23, 2020 3:18 pm

Re: SD Card, can't write from another module or async tasks.

Post by prem111 » Wed May 27, 2020 6:31 am

Yes, I do it exactly, it works when I start from one class, but when I do mount in main.py, while open and write in async def doesn't work anymore.

prem111
Posts: 58
Joined: Sun Feb 23, 2020 3:18 pm

Re: SD Card, can't write from another module or async tasks.

Post by prem111 » Wed May 27, 2020 10:48 am

Ok sorry, my mistake. Its work fine !

Post Reply