mounting SD card to "/" before files stored on grand central causes error no such file/directory

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
tom2021
 
Posts: 49
Joined: Tue Dec 28, 2021 9:07 am

mounting SD card to "/" before files stored on grand central causes error no such file/directory

Post by tom2021 »

If you setup the SD card once with mount_sd.mpy "/" before fonts and images that are also stored on the Grand Central M4 Express in there own folder, it says there is no such file or directory. Not sure if this is intended behaviour and the SD card mount should not store files on "/" but in a folder "/sd". The solution is to set the SD card with a folder storage.mount(vfs, "/sd") instead of root and it doesn't get confused.

Code: Select all

Adafruit CircuitPython 8.0.3 on 2023-02-23; Adafruit Grand Central M4 Express with samd51p20

adafruit-circuitpython-grandcentral_m4_express-en_GB-8.0.3.uf2
update-bootloader-grandcentral_m4-v3.15.0.uf2
mount_sd.mpy

Code: Select all

import board
import busio
import sdcardio
import storage

spi = busio.SPI(board.SD_SCK, board.SD_MOSI, board.SD_MISO)
sdcard = sdcardio.SDCard(spi, board.SD_CS)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/")
code.py

Code: Select all

import mount_sd
from adafruit_bitmap_font import bitmap_font

font = bitmap_font.load_font("/fonts/test.pcf")
error

Code: Select all

Traceback (most recent call last):
  File "adafruit_bitmap_font/bitmap_font.py", line 47, in load_font
OSError: [Errno 2] No such file/directory: /fonts/test.pcf

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: mounting SD card to "/" before files stored on grand central causes error no such file/directory

Post by adafruit_support_mike »

[moved to the CircuitPython forum]

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”