source: ammosreader/sample_scripts/pdw_reader.py@ f3421e6

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

updated sample_scripts

  • Property mode set to 100644
File size: 646 bytes
Line 
1import os
2import sys
3sys.path.append('../src/')
4
5from ammosreader.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.