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

Fixing a problem with BeautifulSoup lib, which causes 'browse_website' command to fail #2596

Closed

Conversation

peterbanda
Copy link
Contributor

Background

As reported in the issue #2514, browse_website command fails (in particular, its parsing part) with an error module 'collections' has no attribute 'Callable'.

The issue appears on Python 3.10 (3.10.11) as well as 3.11 (3.11.3), and on both, the master branch and the last stable release - version 0.2.1.

Changes

I was able to fix the issue by following: https://stackoverflow.com/questions/69515086/error-attributeerror-collections-has-no-attribute-callable-using-beautifu

In particular, added the following imports to the file web_selenium.py before from bs4 import BeautifulSoup

import collections
import collections.abc

collections.Callable = collections.abc.Callable

Documentation

No in-code documentation needed.

Test Plan

Tested the fix on four cases (Python 3.10/3.11 with AutoGPT versions: master and 0.2.1).
In all the cases, after modifying the file web_selenium.py as described above, the issue disappeared 🎉

PR Quality Checklist

  • My pull request is atomic and focuses on a single change.
  • I have thoroughly tested my changes with multiple different prompts.
  • I have considered potential risks and mitigations for my changes.
  • I have documented my changes clearly and comprehensively.
  • I have not snuck in any "extra" small tweaks changes

@k-boikov k-boikov added bug Something isn't working one-liner labels Apr 19, 2023
@Pwuts Pwuts linked an issue Apr 20, 2023 that may be closed by this pull request
1 task
@Pwuts Pwuts changed the title Fixing a problem with BeautifulSoup lib, which causes 'browse_website' command to fail - Issue #2514 Fixing a problem with BeautifulSoup lib, which causes 'browse_website' command to fail Apr 20, 2023
@@ -5,6 +5,11 @@
from pathlib import Path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from pathlib import Path
import collections
import collections.abc
from pathlib import Path

@peterbanda
Copy link
Contributor Author

Note that there is a simpler fix for this issue in PR #2680, which is more preferable (at least from my side).

@Pwuts, @jazelly: If you agree I can close this one.

@Pwuts
Copy link
Member

Pwuts commented Apr 20, 2023

Closing in favor of #2680

@Pwuts Pwuts closed this Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working one-liner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command browse_website fails on Python 3.10 due to Beautiful Soup 4
4 participants