web scraping - Cannot figure out what's wrong with beautifulsoup4 in my python 3 script -


traceback (most recent call last):   file "urlgrabber.py", line 1, in <module>     bs4 import beautifulsoup   file "/users/asdf/desktop/scraper/bs4/__init__.py", line 29, in <module>     .builder import builder_registry   file "/users/asdf/desktop/scraper/bs4/builder/__init__.py", line 4, in <module>     bs4.element import (   file "/users/asdf/desktop/scraper/bs4/element.py", line 5, in <module>     bs4.dammit import entitysubstitution   file "/users/asdf/desktop/scraper/bs4/dammit.py", line 13, in <module>     import logging   file "/library/frameworks/python.framework/versions/3.5/lib/python3.5/logging/__init__.py", line 28, in <module>     string import template importerror: cannot import name 'template' 

i have code scrapes link off of website. working fine till started returning error on command prompt. using python 3. have downloaded bs4 , updated along python. still getting error. still new python/programming , not sure how fix this. put command prompt's messages above. code before standard scraping code worked fine reason of not working. can have 'from bs4 import beautifulsoup' on new .py file , it'll give me same error:

file "bs4fml.py", line 1, in <module>     bs4 import beautifulsoup   file "/users/asdf/desktop/scraper/bs4/__init__.py", line 29, in <module>     .builder import builder_registry   file "/users/asdf/desktop/scraper/bs4/builder/__init__.py", line 4, in <module>     bs4.element import (   file "/users/asdf/desktop/scraper/bs4/element.py", line 5, in <module>     bs4.dammit import entitysubstitution   file "/users/asdf/desktop/scraper/bs4/dammit.py", line 13, in <module>     import logging   file "/library/frameworks/python.framework/versions/3.5/lib/python3.5/logging/__init__.py", line 28, in <module>     string import template 

i searched error message , came this: https://bbs.archlinux.org/viewtopic.php?id=142036

it looks problem python trying import string local source instead of own string library because have named string.py and/or string.pyc file in working directory.

try deleting both string.py , string.pyc files , re-run script.


Comments