source: ammosreader/scripts/pdw_reader.py@ 7bc034f

guix
Last change on this file since 7bc034f was 7bc034f, checked in by Enrico Schwass <ennoausberlin@…>, 22 months ago

fix typo

  • Property mode set to 100644
File size: 630 bytes
RevLine 
[1e781ba]1import sys
2
[f3421e6]3from ammosreader.PDW import PDW
[1e781ba]4
[083cf10]5def main():
[1e781ba]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)
[7bc034f]26
27if __name__ == '__main__':
28 main()
Note: See TracBrowser for help on using the repository browser.