python - TypeError: an integer is required (got type str) -


i new python , flask. working way throught tutorials: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iii-web-forms right getting error can't find fix for. have reinstalled python 3.4.3 , reinstalled virtual environment, have copyed code directly tutorial make sure did not make mistake while typing, still nothing works.

init.py

from flask import flask  app = flask(__name__) app.config.from_object('config')  app import views 

views.py

from flask import render_template, flash, redirect app import app .forms import loginform  @app.route('/') @app.route('/index') def index():     user = {'nickname': 'miguel'}     posts = [         {             'author': {'nickname': 'john'},             'body': 'beautiful day in portland!'         },         {             'author': {'nickname': 'susan'},             'body': 'the avengers movie cool!'         }     ]     return render_template("index.html",                            title='home',                            user=user,                            posts=posts)  @app.route('/login', methods=['get', 'post']) def login():     form = loginform()     return render_template('login.html',                            title='sign in',                            form=form) 

forms.py

from flask.ext.wtf import form wtforms import stringfield, booleanfield wtforms.validators import datarequired  class loginform(form):     openid = stringfield('openid', validators=[datarequired()])     remember_me = booleanfield('remember_me', default=false) 

run.py

from app import app app.run(debug=true) 

the error:

(flask) g:\microblog>python run.py traceback (most recent call last):   file "run.py", line 1, in <module>     app import app   file "g:\microblog\app\__init__.py", line 6, in <module>     app import views   file "g:\microblog\app\views.py", line 3, in <module>     .forms import loginform   file "g:\microblog\app\forms.py", line 1, in <module>     flask.ext.wtf import form   file "<frozen importlib._bootstrap>", line 2237, in _find_and_load   file "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked   file "<frozen importlib._bootstrap>", line 1191, in _load_unlocked   file "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible   file "g:\microblog\flask\lib\site-packages\flask\exthook.py", line 62, in load_module     __import__(realname)   file "g:\microblog\flask\lib\site-packages\flask_wtf\__init__.py", line 15, in <module>     .form import form   file "g:\microblog\flask\lib\site-packages\flask_wtf\form.py", line 15, in <module>     .i18n import translations   file "g:\microblog\flask\lib\site-packages\flask_wtf\i18n.py", line 12, in <module>     flask_babel import get_locale   file "g:\microblog\flask\lib\site-packages\flask_babel\__init__.py", line 21, in <module>     babel import dates, numbers, support, locale   file "g:\microblog\flask\lib\site-packages\babel\dates.py", line 28, in <module>     babel.util import utc, localtz   file "g:\microblog\flask\lib\site-packages\babel\util.py", line 278, in <module>     babel import localtime   file "g:\microblog\flask\lib\site-packages\babel\localtime\__init__.py", line 21, in <module>     babel.localtime._win32 import _get_localzone   file "g:\microblog\flask\lib\site-packages\babel\localtime\_win32.py", line 18, in <module>     tz_names = get_global('windows_zone_mapping')   file "g:\microblog\flask\lib\site-packages\babel\core.py", line 58, in get_global     _global_data = pickle.load(fileobj) typeerror: integer required (got type str) 

i frustrated can't continue tutorial, welcome.

the old version of babel doesn't work 3.4. install update instead:

pip3.4.exe install git+https://github.com/mitsuhiko/babel.git@2.0

it works python3.4 no longer need downgrade python.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -