Skip to content

allow python3 and add quiet mode

This allows the code to be the same for python2 and python3 when we are printing messages and improves the CLI, making a help message automatically and documenting the different user options.

Closes #1 (closed)

Tests

I tested this manually with four different Python versions (v2.7.18, v3.10.6, v3.11.2). For each Python version, I ran four different commands.

  1. python[3] readMilleBinary.py uncorrupted.bin : default printing of first 10 records
  2. python[3] readMilleBinary.py --num-records -1 uncorrupted.bin : print headers-only but look through entire file
  3. python[3] readMilleBinary.py --num-records -1 --quiet uncorrupted.bin: look through entire file, only printing summary at the end
  4. python[3] readMilleBinary.py --num-records -1 --quiet corrupted.bin: look through entire file, making sure it catches the corruption

uncorrupted.bin is a copy of an example file I've used with HPS and is available online (click to download, ~66M). corrupted.bin is created by only copying the first X bytes from uncorrupted.bin using dd: dd bs=1 count=66359000 if=fee_recon_20um120nA_197_mille.bin of=corrupted_mille.bin.

The output of all four different commands is the same across the different python versions.

Happy to do more testing if you think there are other things to check!

Merge request reports

Loading