Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Logging to the CurcuitPY Drive
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Logging to the CurcuitPY Drive

by gjk_baker on Mon May 03, 2021 6:20 pm

Going through your learning guide "A Logger for CircuitPython", it says that I should be able to log to the CurcuitPY drive.

with open('log.txt', 'a+') as f:
f.write("zzzzzz")

I am getting this error
[Errno 30] Read-only filesystem

Am I missing something?
The reason I want to perform this operation is to log errors when under batter and BLE operation.

thx

gjk_baker
 
Posts: 29
Joined: Mon Feb 01, 2021 5:19 pm

Re: Logging to the CurcuitPY Drive

by danhalbert on Mon May 03, 2021 8:50 pm

Check out this example. You need to remount the filesystem as read/write. Normally it is not writable from Python because the host computer can write to it.

https://learn.adafruit.com/circuitpytho ... on-storage

danhalbert
 
Posts: 2376
Joined: Tue Aug 08, 2017 12:37 pm

Re: Logging to the CurcuitPY Drive

by gjk_baker on Wed May 05, 2021 2:36 pm

Thanks for the reference. Don't know how I missed that

gjk_baker
 
Posts: 29
Joined: Mon Feb 01, 2021 5:19 pm

Please be positive and constructive with your questions and comments.