Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAttributeError when calling a method which returns a BeautifulSoup object #245
Comments
|
The error log is
From https://github.com/google/python-fire/blob/master/fire/decorators.py#L87 def GetMetadata(fn):
# Class __init__ functions and object __call__ functions require flag style
# arguments. Other methods and functions may accept positional args.
default = {
ACCEPTS_POSITIONAL_ARGS: inspect.isroutine(fn),
}
return getattr(fn, FIRE_METADATA, default)
For def __getattr__(self, tag):
"""Calling tag.subtag is the same as calling tag.find(name="subtag")"""
...So A quick fix is to check if the |
|
Thanks for diving into that @WaizungTaam! Your suggested fix sounds good to me. |
This is a small example to reproduce the error:
If I run this file via
I get the error "AttributeError: 'NoneType' object has no attribute 'get'".
If I run
the variable result does not contain the expected soup object, but instead "<bound method Test.get_soup of <__main__.Test object at 0x7f80840e5460>>"