gsurma / text_predictor

Char-level RNN LSTM text generator📄.
https://gsurma.github.io
MIT License
116 stars 35 forks source link

Type Error #2

Closed siusoon closed 6 years ago

siusoon commented 6 years ago

Traceback (most recent call last): File "text_predictor.py", line 114, in rnn() File "text_predictor.py", line 76, in rnn sample_text(sess, data_provider, iteration) File "text_predictor.py", line 93, in sample_text output.write(text + "\n") TypeError: can't concat str to bytes

Any clue?

gsurma commented 6 years ago

I am not 100% sure what’s causing the issue, but please check if your datasest is utf-8 encoded.

Another thing that came to my mind - it might be python 2/3 compatibility issue. I have tested it only with python 2.

fonzai commented 6 years ago

With python3 you can change it to output.write(str(text) + "\n"). Seemed to do the trick for me.

I had to also change all the print ".." lines to use parenthesis like print("..")

siusoon commented 6 years ago

Yes @gsurma it is the compatibility. And @fonzai it works after the changes! Many thanks!!!