Olá,
Tive exatamente o mesmo erro citado na postagem https://cursos.alura.com.br/forum/topico-attributeerror-nonetype-object-has-no-attribute-group-252091, usando o Google translator recebo uma mensagem de erro diferente. Alguém poderia me ajudar?
Abaixo o meu código:
from flask import Flask
from textblob import TextBlob
from googletrans import Translator
app = Flask(__name__)
translator = Translator()
@app.route('/')
def home():
return 'Minha primeira API'
@app.route('/sentimento/<frase>')
def sentimento(frase):
frase_en = translator.translate(frase, dest='en')
tb_en = TextBlob(frase_en.text)
polaridade = tb_en.sentiment.polarity
return "Polaridade {}".format(polaridade)
app.run(debug=True)
E o erro recebido:
Traceback (most recent call last):
File "C:/Users/c117813/PycharmProjects/CursoFlask/main.py", line 2, in <module>
from textblob import TextBlob
File "C:\Users\c117813\PycharmProjects\CursoFlask\venv\lib\site-packages\textblob\__init__.py", line 2, in <module>
from .blob import TextBlob, Word, Sentence, Blobber, WordList
File "C:\Users\c117813\PycharmProjects\CursoFlask\venv\lib\site-packages\textblob\blob.py", line 29, in <module>
import nltk
File "C:\Users\c117813\PycharmProjects\CursoFlask\venv\lib\site-packages\nltk\__init__.py", line 153, in <module>
from nltk.translate import *
File "C:\Users\c117813\PycharmProjects\CursoFlask\venv\lib\site-packages\nltk\translate\__init__.py", line 24, in <module>
from nltk.translate.meteor_score import meteor_score as meteor
File "C:\Users\c117813\PycharmProjects\CursoFlask\venv\lib\site-packages\nltk\translate\meteor_score.py", line 13, in <module>
from nltk.corpus import WordNetCorpusReader, wordnet
File "C:\Users\c117813\PycharmProjects\CursoFlask\venv\lib\site-packages\nltk\corpus\__init__.py", line 64, in <module>
from nltk.corpus.reader import *
File "C:\Users\c117813\PycharmProjects\CursoFlask\venv\lib\site-packages\nltk\corpus\reader\__init__.py", line 106, in <module>
from nltk.corpus.reader.panlex_lite import *
File "C:\Users\c117813\PycharmProjects\CursoFlask\venv\lib\site-packages\nltk\corpus\reader\panlex_lite.py", line 15, in <module>
import sqlite3
File "C:\Users\c117813\Anaconda2018.12_x64_Python3.7\lib\sqlite3\__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "C:\Users\c117813\Anaconda2018.12_x64_Python3.7\lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed: Não foi possível encontrar o módulo especificado.
Process finished with exit code 1