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

'NoneType' object has no attribute 'format' #38

Closed
TheML9I opened this issue Jun 3, 2016 · 4 comments
Closed

'NoneType' object has no attribute 'format' #38

TheML9I opened this issue Jun 3, 2016 · 4 comments
Assignees
Labels

Comments

@TheML9I
Copy link

TheML9I commented Jun 3, 2016

If you use uwsgi with parameter optimize=2 you can get error with using it:

AttributeError at /mymodule/api/
'NoneType' object has no attribute 'format'

interpreter info:

Python Executable: /home/httpd/app/bin/uwsgi
Python Version: 2.7.5

additional:

-O Turn on basic optimizations. This changes the filename extension for compiled (bytecode) files from .pyc to .pyo. See also PYTHONOPTIMIZE.
-OO Discard docstrings in addition to the -O optimizations.

As possible solution add for py23compat.py

return s.format(u='u') if s else s

Any ideas?

Thnx!

@SethMMorton
Copy link
Owner

You are removing function docstrings with an optimization flag, and this is causing errors with the compat code because it expects docstrings to exist. Do I understand your issue correctly? If so, this seems like it will be a straightforward fix.

@SethMMorton SethMMorton added the bug label Jun 3, 2016
@SethMMorton
Copy link
Owner

As a side note, the py23compat.py file hasn't existed in natsort since version 4.0.1... version 4.0.3 was released almost a year ago, and there is now version 5.0.0. Is there a reason you haven't upgraded?

@SethMMorton SethMMorton self-assigned this Jun 4, 2016
SethMMorton added a commit that referenced this issue Jun 4, 2016
The -OO flag removes docstrings (sets them to None), which caused
issues with the doctoring compatability wrapper because it was trying
to call .format on None.

The wrapper has been modified to check for None.

This should solve issue #38.
@SethMMorton
Copy link
Owner

Version 5.0.1 incorporates this update.

@TheML9I
Copy link
Author

TheML9I commented Jun 6, 2016

You're right.

We're using ver. 3.5 in our local PYPI. But we checked ver. 5 installed from common PYPI and had similar error. I think your last fix solve it. As soon as possible i check it! Thanks!

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

No branches or pull requests

2 participants