I have never executed a script, Python or otherwise, in Terminal.
After some fun discovery, I found the Python Launcher and the rest is history. I dropped the .ini and the .tmp files in a directory alone, ran the .py and bingo, I got the .bak and the .old, with the .ini now being just as we are accustomed to. Really appreciate your doing this, especially on my pestering you.
May be you can solve it in the OS? We don’t have a local time, but we have the FAT timestamp. What if you took the existing Modified Timestamp of the .ini and .tmp files after you mod them, and simply keep if they are in the correct order or add enough to the newer so it’s newer (say, other’s +1)?
That’s sort of unfortunate though.
It uses the location of the script instead of the current directory, which is not very natural on most unix-like platforms. If I was using this script frequently, I would stick the script in $HOME/bin/ or /usr/local/bin/ then run it in whatever directory I want.
On windows, when you just click on the script, is the “current directory” set to:
a) where the script is
b) where the python binary is
c) something else?
First of all, I made an update to the script so that you can unlock any config file, not just presets.ini/tmp.
Second, I tested it on windows, and it seems like you can keep the script anywhere, and just drag-and-drop the config file you want to unlock onto the script. Of course, I did have to install python first, but I didn’t have to do anything else.
Setup is three internal pixel accents wired in series and coded as sub blades to blink/pulse blue when main blade is off. In the video below, the accents in question are the ones inside the vents at the back of the speaker (two pixels) and the crystal chamber (one pixel). You can also see the OLED on the underside of the chassis reflecting off the tabletop.
The symptoms are that when the OLED battery level display switches off after about 30 seconds, the sub blade accents inexplicably light up full on - two white and one blue.
The problem doesn’t occur under USB power, only battery power.
Once the fault has started, if I power up the blade they return to normal, but again the problem returns around 30 seconds after I power the main blade down again, roughly coinciding with OLED battery level display turning off.
Config is set so all accents shutdown after half an hour.
The sub blade array is fed from data 1 so no need for a resistor.
The fixes I’ve found are:
Using OS 7.1 or 7.2, if I write the OLED out of the config, the problem goes away.
If I leave the OLED in the config but revert to OS 6.8 the problem goes away.
So on the face of it, it looks like something about the OLED setup is upsetting data 1 under OS-7.x. Of course I’m happy to be corrected if it turns out to be a gremlin of my own making, but the fixes I’ve found above make me think that it isn’t.
If you’re in the directory with the script, chmod +x ./unlock_presets_ini.py
to make it executable.
Yes. It puts the path of the script in, and enter runs it.
This is with the script in the same directory as the .ini and .tmp files.
For my testing, that directory is /Users/bconner/Desktop/py
Appending the .ini file to the command doesn’t work:
Traceback (most recent call last):
File "/Users/bconner/Desktop/py/unlock_presets_ini.py", line 82, in <module>
File "/Users/bconner/Desktop/py/unlock_presets_ini.py", line 67, in main
ini = ProffieSafe(ini_filename)
File "/Users/bconner/Desktop/py/unlock_presets_ini.py", line 9, in __init__
self.f = open(filename, "rb")
NotADirectoryError: [Errno 20] Not a directory: '/Users/bconner/Desktop/py/presets.ini/presets.ini'
Really silly solution (please don’t hit me): what about a third file called something like “lastest.ini” which just plains states the latest config. I.e. it will just have “presets.ini” or “presets.tmp”. It’s a lot easier to make a script that simply cats the name of the file you want to edit/backup/etc.
Not impossible, but it’s a single point of failure.
If you fail halfway through writing to that file, then you don’t know which file is the latest, and you need another way to decide which file is the latest, meaning that you’re essentially back to square one.