pender / chatbot-rnn

A toy chatbot powered by deep learning and trained on data from Reddit
MIT License
899 stars 370 forks source link

Syntax Error, Invalid Syntax : end='', flush=True #35

Closed MauryaRitesh closed 6 years ago

MauryaRitesh commented 6 years ago

I got the following error: riteshk_m_786@bot:~/chatbot-rnn$ python train.py File "train.py", line 179 end='', flush=True) ^ SyntaxError: invalid syntax

pender commented 6 years ago

The script is written in Python 3 -- are you running the script in Python 2? Make sure Tensorflow is installed for Python 3 and then try $ python3 train.py.

MauryaRitesh commented 6 years ago

No, I also have Python 3

pender commented 6 years ago

Try $ python3 train.py instead of $ python train.py

MauryaRitesh commented 6 years ago

The same error message.

pender commented 6 years ago

I think you must be running this in Python 2. Try creating a new python script that contains only the following:

print("Hello", flush=True)

Run that that the same way that you are running the training script. I expect you'll get the same error. The flush argument was added in Python 3.3.

I added a check to the train script to make sure that it's being run in Python 3. I'd be curious what the result is for you with that change.