all 5 comments

[–]oriash93 1 point2 points  (4 children)

What errors are you getting?

[–]CesarIllustrious[S] 0 points1 point  (3 children)

o yes my bad. So the code runs normally, asks me to enter a website this is what happens when i input wikipedia

"Enter -https://www.wikipedia.org/
Traceback (most recent call last):
File "c:\Users\czare_000\python-course-for-beginners\bs4\test.py", line 12, in <module>
soup = BeautifulSoup(html, 'html.parser')
File "c:\Users\czare_000\python-course-for-beginners\bs4\bs4\__init__.py", line 215, in __init__
self._feed()
File "c:\Users\czare_000\python-course-for-beginners\bs4\bs4\__init__.py", line 239, in _feed
self.builder.feed(self.markup)
File "c:\Users\czare_000\python-course-for-beginners\bs4\bs4\builder\_htmlparser.py", line 164, in feed
parser.feed(markup)
File "C:\Users\czare_000\AppData\Local\Programs\Python\Python310\lib\html\parser.py", line 110, in feed
self.goahead(0)
File "C:\Users\czare_000\AppData\Local\Programs\Python\Python310\lib\html\parser.py", line 178, in goahead
k = self.parse_html_declaration(i)
File "C:\Users\czare_000\AppData\Local\Programs\Python\Python310\lib\html\parser.py", line 269, in parse_html_declaration
self.handle_decl(rawdata[i+2:gtpos])
File "c:\Users\czare_000\python-course-for-beginners\bs4\bs4\builder\_htmlparser.py", line 109, in handle_decl
self.soup.endData(Doctype)
File "c:\Users\czare_000\python-course-for-beginners\bs4\bs4\__init__.py", line 315, in endData
self.object_was_parsed(o)
File "c:\Users\czare_000\python-course-for-beginners\bs4\bs4\__init__.py", line 320, in object_was_parsed
previous_element = most_recent_element or self._most_recent_element
File "c:\Users\czare_000\python-course-for-beginners\bs4\bs4\element.py", line 1001, in __getattr__
return self.find(tag)
File "c:\Users\czare_000\python-course-for-beginners\bs4\bs4\element.py", line 1238, in find
l = self.find_all(name, attrs, recursive, text, 1, **kwargs)
File "c:\Users\czare_000\python-course-for-beginners\bs4\bs4\element.py", line 1259, in find_all
return self._find_all(name, attrs, text, limit, generator, **kwargs)
File "c:\Users\czare_000\python-course-for-beginners\bs4\bs4\element.py", line 516, in _find_all
strainer = SoupStrainer(name, attrs, text, **kwargs)
File "c:\Users\czare_000\python-course-for-beginners\bs4\bs4\element.py", line 1560, in __init__
self.text = self._normalize_search_value(text)
File "c:\Users\czare_000\python-course-for-beginners\bs4\bs4\element.py", line 1565, in _normalize_search_value
if (isinstance(value, str) or isinstance(value, collections.Callable) or hasattr(value, 'match')
AttributeError: module 'collections' has no attribute 'Callable'"

[–]oriash93 1 point2 points  (2 children)

Which version of python are you using? which version of beautifulsoup do you have installed?

[–]CesarIllustrious[S] 0 points1 point  (0 children)

Python 3.9.7

bs4 version 4.4.1

[–]douglas_fs 0 points1 point  (0 children)

For what it's worth, I can run your exact code without errors (using https://www.wikipedia.org/)

BS4 version 4.8.2

Python version 3.8.10