Skip to content

Filesystem isn't allowing me to write to it #6716

@pianpie

Description

@pianpie

My filesystem isn't allowing me to write to it. I imported storage correctly but the filesystem is stuck in in read-only for circuit python. I followed this guide and it didn't work. The filesystems mode was never changed. I am using the metro m4 express.
Boot.py:

import board
import digitalio
import storage



# For Feather M0/M4 Express
switch = digitalio.DigitalInOut(board.D2)

switch.direction = digitalio.Direction.INPUT
switch.pull = digitalio.Pull.UPswitch.direction = digitalio.Direction.INPUT
switch.pull = digitalio.Pull.UP
# If the switch pin is connected to ground CircuitPython can write to the drive
storage.remount("/", switch.value)

code.py:

import time
import board
import digitalio
import microcontroller
import storage
led.switch_to_output()
switch = digitalio.DigitalInOut(board.D2)
switch.direction = digitalio.Direction.INPUT
switch.pull = digitalio.Pull.UP
print(switch.value)
try:
    print("in try")
    with open("test.txt", "a") as fp:
        while True:
            fp.write("this works")
            led.value = not led.value
            print("pog")
            time.sleep(1)
except OSError as e:
    print("os error")

    while True:
        time.sleep(1)
        print(switch.value)

The filesystem isn't being changed and it's stuck in read-only for circuit python

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions