Skip to content

AttributeError when calling a method which returns a BeautifulSoup object #245

Open
@gab50000

Description

@gab50000

This is a small example to reproduce the error:

import bs4
import fire

assert fire.__version__ == "0.3.1"

class Test:
    def get_soup(self):
        soup = bs4.BeautifulSoup("<h1>hi</h1>")
        return soup


fire.Fire(Test)

If I run this file via

python test.py get_soup

I get the error "AttributeError: 'NoneType' object has no attribute 'get'".

If I run

python test.py get_soup -- --interactive

the variable result does not contain the expected soup object, but instead "<bound method Test.get_soup of <__main__.Test object at 0x7f80840e5460>>"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions