Ignore:
Timestamp:
03/17/13 22:26:27 (11 years ago)
Author:
tmorgan
Message:

Switched to python3 only, since supporting both 2.x and 3.x is such a pain

Added preliminary python-requests support to http2py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/bletchley-analyze

    r35 r40  
    1 #!/usr/bin/env python
     1#!/usr/bin/env python3
    22
    3 # Requires Python 2.7+
     3# Requires Python 3+
    44
    55'''
     
    5454    sys.exit(0)
    5555
    56 input_file = sys.stdin
     56input_file = sys.stdin.buffer
    5757if options.input_file is not None:
    58     input_file = file(options.input_file, 'rb')
     58    input_file = open(options.input_file, 'rb')
    5959
    60 blobs = input_file.read().rstrip('\n').replace('\r', '').split('\n')
     60blobs = input_file.read().rstrip(b'\n').replace(b'\r', b'').split(b'\n')
    6161#print(repr(blobs))
    6262
     
    8181    line_size = 64
    8282    group_size *= 2 # two hex digits per byte
    83     hex_blobs = map(binascii.b2a_hex, blobs)
     83    hex_blobs = [binascii.b2a_hex(b) for b in blobs]
    8484    color_map = buffertools.blockWiseColorMap(group_size, hex_blobs)
    8585
    8686    for k in range(0,len(hex_blobs)):
    87         hex = hex_blobs[k]
     87        hex = hex_blobs[k].decode()
    8888       
    8989        for i in range(0,len(hex),line_size):
     
    9898       
    9999            line += '| '
    100             line += repr(blobs[k][i/2:(i+line_size)/2])
     100            line += repr(blobs[k][i//2:(i+line_size)//2])
    101101       
    102102            print(line)
     
    136136        encoding = specified_encodings.pop(0)
    137137
    138 
    139138    blobs_to_print = blobs[:options.output_lines]
    140139    print('First %d Values:' % len(blobs_to_print))
Note: See TracChangeset for help on using the changeset viewer.