1

I am currently using this code (https://github.com/arngarden/python_java_datastream/blob/master/data_input_stream.py) in order to read Java Input Data Stream floats in Python, it works fine on python 2.7 but in python 3 i keep getting this error:

'charmap' codec can't decode byte 0x86 in position 1689: character maps to undefined

I am using it here:

with open("data.dat","wb") as outf:
    output = dos.DataOutputStream(outf)
    with open(filename+'.input') as f:
        dis = din.DataInputStream(f)
        inputdata = [ [0]*(784*2) for _ in range(1) ]
        outputdata = [ [0]*2 for _ in range(1) ]
        count = 0
        for _ in range((100-13*A-14*B)**2):
            for j in range(3*28*28):
                inputdata[0][j] = dis.read_float()
            out = sess.run(y_ans,feed_dict={x:inputdata})
            if count%100 == 0:
                print(count)
            count+=1
            output.write_boolean(out[0])

    print('exporting took ' + str((time.time()-init_time)/60) + ' minutes')

0 Answers0