Skip to content

Improve error message when importing missing package extras #155

Closed

Description

@vdusek

When installing crawlee like this:

pip install crawlee

And then importing BeautifulSoupCrawler.

I would get just a general ImportError.

Add some import checks and print user-friendly error messages. E.g.:

try:
    from bs4 import BeautifulSoup
except ImportError as exc:
    raise ImportError(
        'To use this module, you need to install the "beautifulsoup" extra. Run "pip install crawlee[beautifulsoup]".',
    ) from exc

Check https://github.com/apify/apify-sdk-python/blob/master/src/apify/scrapy/scheduler.py#L5:L13 as inspiration.

Activity

  1. added
    enhancementNew feature or request.
    t-toolingIssues with this label are in the ownership of the tooling team.
    on May 15, 2024
  2. added 2 commits that reference this issue on May 31, 2024
    f15a476
    8048f2d
  3. self-assigned this
    on May 31, 2024
  4. added a commit that references this issue on May 31, 2024
    200ebfa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request.t-toolingIssues with this label are in the ownership of the tooling team.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions