'NoneType' object has no attribute 'attrs'
See original GitHub issueI’m trying import-export on Django 3, python 3.8, on a fairly large site with lots of models, but I encounter this on the first class inspected in this code, which is import_export.resources.Resource
.
from import_export import resources
File "/usr/lib/python3.8/site-packages/import_export/resources.py", line 234, in <module>
class Resource(metaclass=DeclarativeMetaclass):
File "/usr/lib/python3.8/site-packages/import_export/resources.py", line 202, in __new__
setattr(meta, option, getattr(options, option))
AttributeError: 'NoneType' object has no attribute 'attrs'
When I add code to avoid that (if options:
), I then encounter
from import_export import resources
File "/usr/lib/python3.8/site-packages/import_export/resources.py", line 986, in <module>
class ModelResource(Resource, metaclass=ModelDeclarativeMetaclass):
File "/usr/lib/python3.8/site-packages/import_export/resources.py", line 914, in __new__
new_class = super().__new__(cls, name, bases, attrs)
File "/usr/lib/python3.8/site-packages/import_export/resources.py", line 183, in __new__
setattr(meta, option, getattr(options, option))
AttributeError: 'NoneType' object has no attribute 'attrs'
Again a guard if options:
around that code helps.
- Django Import Export: 2.0.2, 2.3.0, master
- Python 3.8
- Django 3.0.8
Odd packages which might be related are django-compat-patcher
, and forbiddenfruit
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
AttributeError: 'NoneType' object has no attribute 'attrs' [closed]
I am new to python. Please help me with this error. AttributeError: 'NoneType' object has no attribute 'attrs' from bs4 ...
Read more >AttributeError: 'NoneType' object has no attribute 'attrs' · Issue ...
hello, i used the provided example in the 'examples' folder but i get the below error I logged in manually to linkedin and...
Read more >Python – AttributeError: 'NoneType' object has no attribute 'attrs'
I am new to python. Please help me with this error. AttributeError: 'NoneType' object has no attribute 'attrs' from bs4 import BeautifulSoup import...
Read more >How do I fix : attributeerror: 'nonetype' object has no attribute ...
When ever you get a problems that involves a message such as " 'nonetype' object has no attribute ..." it means the same...
Read more >[FIXED] AttributeError: 'NoneType' object has no attribute ...
Hence, AttributeError: 'NoneType' object has no attribute 'something' error occurs when the type of object you are referencing is None.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
On
forbiddenfruit.py
we replaced:with:
So it’s doing a dir(None) but that’s ok for our use case of the module.
Fixed in #1325