source: ammosreader/scripts/pdw_reader.py@ 0b489f2

guix
Last change on this file since 0b489f2 was 083cf10, checked in by Enrico Schwass <ennoausberlin@…>, 2 years ago

use poetry for package definition

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