Forums

Import error : flask_mail

Hi,

I have a problem with importing (flask.ext.mail) when running my app on pythonanywhere, and here is the code of(forms.py)

from flask.ext.wtf import FlaskForm
from wtforms import TextField, TextAreaField, SubmitField, validators, ValidationError,SelectField,IntegerField

class ContactForm(FlaskForm):
  name = TextField("name")
  ....

the code of(routes.py):

from forms import ContactForm
from flask.ext.mail import Message, Mail
....

The app works fine locally.

Python version locally and on pythonanywhere (when create the app I choose) is 3.6.1.

Flask version locally and on pythonanywhere (when create the app I choose) is 0.12.2

flask.ext.mail version locally is 0.9.1

However, when cd to the app folder and check the versions I got:

consol screenshot

but in the website dashboard interface the python version is:

dashboard screenshot

I don't understand the problem! Any help please!

Thanks in advance.

I can't see either of those screenshots I'm afraid. but i don't think we install flask-ext-mail by default for 3.6, so you'll need to install it yourself: https://help.pythonanywhere.com/pages/InstallingNewModules

Thank you so much harry! It works!

Solution:

bash consol

cd to the web folder
pip3 install --user Flask_Mail

*For images > right click > open image in new tap.

You saved my day!

Thank you again.

:)