source: ammosreader/sample_scripts/pdw_reader.py@ d88bd02

AmmosSource guix
Last change on this file since d88bd02 was 1e781ba, checked in by recknagel <recknagel@…>, 3 years ago

former radardex-project

  • Property mode set to 100644
File size: 650 bytes
Line 
1import os
2import sys
3sys.path.insert(0, os.path.abspath('../'))
4
5from PDW import PDW
6
7if __name__ == '__main__':
8
9 if len(sys.argv) != 2:
10 print("Specify name of .ppdw file")
11 sys.exit()
12
13 file_name = sys.argv[1]
14
15 with open(file_name, 'rb') as f:
16
17 while(True):
18 current_bytes = f.read(32)
19 if current_bytes == '':
20 print("End of file detected")
21 break
22 if len(current_bytes) != 32:
23 print("Can not read all 32 bytes of next PDW")
24 break
25
26 current_pdw = PDW.from_bytes(current_bytes)
27 print(current_pdw)
Note: See TracBrowser for help on using the repository browser.