Python Forum

Full Version: Question on a code's design
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I'm designing a button-less clock using a Raspberry with a SD card and I'm doing it this way:

With a php code I create a data.json settings file where I store alarm time, brightness level, etc.

then with a python code, I load the libraries, read the settings and display time. If the time matches, sounds an alarm.

Because the code displays the time every seconds, the settings file (data.json) is constantly read.

My question is, if reading the data file so many times per minutes and thus per year, is it affecting the SD card's life or is there a better way of doing it?

TIA
I see at least 2 other ways to do it
  1. Write the json file on a ramdisk instead of the SD card, or
  2. Start a server with the python script, such as a web server or a xmlrpc server or a simple socketserver, then attempt to connect this server from the php script and send the data instead of writing them in a json file.