daniel-kukiela / nmt-chatbot

NMT Chatbot
GNU General Public License v3.0
387 stars 214 forks source link

TypeError: 'encoding' is an invalid keyword argument for this function #181

Closed Allan1901 closed 2 years ago

Allan1901 commented 2 years ago

I'm having an error related to encoding while trying to run prepare_data.py Os: Live Lubuntu 20.04 Anaconda environment :

  1. Python 2.7.16
  2. tensorflow 1.4.1
  3. conda 4.10.1
  4. tqdm 4.62.3
  5. colorama 0.4.4
  6. regex 2.5.76
  7. python-Levenshtein
  8. requests 2.24.0

Error after run "prepare_data.py" :

python prepare_data.py
  File "prepare_data.py", line 522
SyntaxError: Non-ASCII character '\xe2' in file prepare_data.py on line 522, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

After adding # -*- coding: utf-8 -*- to "prepare_data.py" :

python prepare_data.py
Traceback (most recent call last):
  File "prepare_data.py", line 7, in <module>
    from core.tokenizer import tokenize
  File "/media/lubuntu/TOSHIBA/vit/w/paralel universe3/code/projetos sem pycharm/deb/treinando/nmt-chatbot/core/tokenizer.py", line 36
SyntaxError: Non-ASCII character '\xe2' in file /media/lubuntu/TOSHIBA/vit/w/paralel universe3/code/projetos sem pycharm/deb/treinando/nmt-chatbot/core/tokenizer.py on line 36, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

After adding # -*- coding: utf-8 -*- to "nmt-chatbot/core/tokenizer.py" :

python prepare_data.py
Traceback (most recent call last):
  File "prepare_data.py", line 7, in <module>
    from core.tokenizer import tokenize
  File "/media/lubuntu/TOSHIBA/vit/w/paralel universe3/code/projetos sem pycharm/deb/treinando/nmt-chatbot/core/tokenizer.py", line 13, in <module>
    with open(preprocessing['protected_phrases_file'], 'r', encoding='utf-8') as protected_file:
TypeError: 'encoding' is an invalid keyword argument for this function

So i dont know where to go from here. I didnt had this error while trying to run it on python3, but on python 3 i couldnt install tensorflow 1.4, so ... I had to downgrade to python2.7, where i'm having this problem now.

Allan1901 commented 2 years ago

It was actually possible to install the old ersion of tensorflow with python 3.7, wich solved this problem.