BeautifulSoup AttributeError 'collections' has no attribute 'Callable'

Viewed 16148

I followed all steps to install the beautifulsoup but it still comes out with this error:

AttributeError: module 'collections' has no attribute 'Callable'

stacktrace

I am using python 3.10.

7 Answers
import collections
collections.Callable = collections.abc.Callable

use this !

Got same AttributeError, Then look inside python lib > collections folder has abc (abstract base classes) made separately in version 3.3 and above. So resolving error by opening /bs4/elements.py in editor and replacing collections.callable >> to >> collections.abc.callable hence callable attribute can be easily accessed.

BeautifoulSoup did not work with 3.10 reinstall 3.9 Shoikan

Change "%LOCALAPPDATA%\Programs\Python\Python310\Lib\site-ackages\pyreadline\py3k_compat.py" - 8th code as below: return isinstance(x, collections.abc.Callable)

This solution worked for me:

  1. Navigate to Python310\Lib\site-packages\pyreadline in your file browser.
  2. Open py3k_compat.py in an text editor.
  3. Change the 8th line from which should be return isinstance(x, collections.Callable) to return isinstance(x, collections.abc.Callable).
  4. Save, exit and then retry.

I was getting the same error while trying to run manticore but apparently non of the answers were answering Mac users. So if you are on mac and getting the same error you gotta navigate to

lib/python3.10/site-packages/wasm/types.py Line 246

and change

isinstance(cur_field, collections.Callable) to isinstance(cur_field, collections.abc.Callable)

I had Beautifulsoup in a folder within the same folder as the python program, as opposed to "installing" it.

So in that folder I opened element.py and replaced all collections.Callable with collections.abc.Callable

python version 3.10.7

Related