Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start sample_app.py error #5

Closed
Linkding opened this issue Sep 6, 2017 · 4 comments
Closed

start sample_app.py error #5

Linkding opened this issue Sep 6, 2017 · 4 comments

Comments

@Linkding
Copy link

Linkding commented Sep 6, 2017

i got the error when i try to run this app

#python simple_app.py 
Traceback (most recent call last):
  File "simple_app.py", line 39, in <module>
    @login_required(username=['chuck', 'mary'])
  File "/usr/local/python2.7/lib/python2.7/site-packages/flask_simplelogin/__init__.py", line 109, in login_required
    @wraps(function)
  File "/usr/local/python2.7/lib/python2.7/functools.py", line 33, in update_wrapper
    setattr(wrapper, attr, getattr(wrapped, attr))
AttributeError: 'NoneType' object has no attribute '__module__'

my env python version is

# python -V
Python 2.7.13 (default, Aug  9 2017, 23:25:57) 

OS system: ** centos 6.5 64bit**

then i also try run python manage.py runserver

Traceback (most recent call last):
  File "manage.py", line 135, in <module>
    main()
  File "/usr/local/python2.7/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/python2.7/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/python2.7/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/python2.7/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/python2.7/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "manage.py", line 89, in decorator
    configure_views(app)
  File "manage.py", line 66, in configure_views
    @login_required()
  File "/usr/local/python2.7/lib/python2.7/site-packages/flask_simplelogin/__init__.py", line 109, in login_required
    @wraps(function)
  File "/usr/local/python2.7/lib/python2.7/functools.py", line 33, in update_wrapper
    setattr(wrapper, attr, getattr(wrapped, attr))
AttributeError: 'NoneType' object has no attribute '__module__'

seems have the same problem

@Linkding
Copy link
Author

Linkding commented Sep 6, 2017

when i remove the code behide @login_required on simple_app.py, then it seems work well

@claytonaalves
Copy link
Contributor

Same problem here.

Python 2.7.13 on Windows.

@rochacbruno
Copy link
Member

Looks like wraps works different in Py 2.7, I'll try a fix for this as I only tested in Python 3.6+

rochacbruno added a commit that referenced this issue Sep 6, 2017
rochacbruno added a commit that referenced this issue Sep 6, 2017
rochacbruno added a commit that referenced this issue Sep 6, 2017
rochacbruno added a commit that referenced this issue Sep 6, 2017
rochacbruno added a commit that referenced this issue Sep 6, 2017
@rochacbruno
Copy link
Member

Fixed in 39435c0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants