Compressing bin file with Python lzss.py algorithm for OTA

Can someone tell me the environment needed to run python's lzss algorithm, which compresses the file in preparation for OTA?
I installed python 3.11.5 on a Windows PC, invoked the program, and tried to run the --encode command but a syntax error was generated. Are you allowed to put the bin file's full directory path in the command line or is something else required? I have a Linux PC but have not attempted the compression using it as the Arduino IDE is on my Windows PC.

Python 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ./lzss.py --encode C:\Users\Ed\Arduino IDE Support Files\ESP32_Blink_For_OTA_Test.ino.bin C:\Users\Ed\Arduino IDE Support Files\ESP32_Blink_For_OTA_Test.ino.lzss
  File "<stdin>", line 1
    ./lzss.py --encode C:\Users\Ed\Arduino IDE Support Files\ESP32_Blink_For_OTA_Test.ino.bin C:\Users\Ed\Arduino IDE Support Files\ESP32_Blink_For_OTA_Test.ino.lzss
    ^
SyntaxError: invalid syntax
>>>

It seems likely that one would run that python program from the PC command line, not the Python interpreter command line.

Try something like
c:\your_folder>python3 lzss.py

which works as expected on my Windows machine, with this version of lzss.py

1 Like

I tried your suggestion and got a little further with it at least opening the file but it generated a Non-UTF-8 code syntax error. I may go to the link the error message provided.
But in the meantime I discovered 'Elegant OTA' and installed it in the IDE library and it works wonderfully with no file compression or other steps for theESP32. So I may not pursue this any further.
My next step is to get OTA for the Arduino UNO Rev2; hopefully that will be fairly straightforward.

C:\Users\Ed\Arduino IDE Support Files>python3 ESP32_Blink_For_OTA_Test.ino.bin
SyntaxError: Non-UTF-8 code starting with '\xe9' in file C:\Users\Ed\Arduino IDE Support Files\ESP32_Blink_For_OTA_Test.ino.bin on line 1, but no encoding declared; see https://peps.python.org/pep-0263/ for details

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.