'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

wrote a sentence:

1 image_raw_data_jpg = tf.gfile.FastGFile('../test_images/test_1.jpg', 'r').read()

Then an error is reported, 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

The reason is the decoding error. The system uses utf-8 by default . The solution is to change to the corresponding decoding method.

I searched and found that changing r to rb solved it.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325865574&siteId=291194637