Keras-yolo3: TypeError: unicode argument expected, got 'str'

Created on 4 Jul 2018  路  6Comments  路  Source: qqwweee/keras-yolo3

Using TensorFlow backend.
Loading weights.
('Weights Header: ', 0, 2, 0, array([32013312]))
Parsing Darknet config.
Traceback (most recent call last):
File "convert.py", line 262, in
_main(parser.parse_args())
File "convert.py", line 83, in _main
unique_config_file = unique_config_sections(config_path)
File "convert.py", line 53, in unique_config_sections
output_stream.write(line)
TypeError: unicode argument expected, got 'str'

Most helpful comment

if your environment is Python2.7, you can change code :
line 10
import io
and
line 47
output_stream路=io.StringIO()

to
line 10
from io import BytesIO as StringIO
line 47
output_stream路= StringIO()

All 6 comments

@hejie the test environment is Python 3.5.2, I guess your environment is Python2.7.

if your environment is Python2.7, you can change code :
line 10
import io
and
line 47
output_stream路=io.StringIO()

to
line 10
from io import BytesIO as StringIO
line 47
output_stream路= StringIO()

@zhoul14 worked for me, thanks!

@zhoul14 Thanks for the solution.

@hejie the test environment is Python 3.5.2, I guess your environment is Python2.7.

Make sure you use python3

If you need both python2 and python2 support you can/should opt for six.StringIO

import six

six.StringIO()
Was this page helpful?
0 / 5 - 0 ratings