Indicates an error in the BeautifulSoup code

Bug #1901216 reported by Ainur on 2020-10-23
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Beautiful Soup

Bug Description

When I do this:

from bs4 import BeautifulSoup
import urllib.request

req = urllib.request.urlopen('')
# html =

An error comes out:

Traceback (most recent call last):
  File "C:/pyton/", line 1, in <module>
    from bs4 import BeautifulSoup
  File "C:\pyton\venv\lib\site-packages\bs4\", line 32, in <module>
    from .builder import builder_registry, ParserRejectedMarkup
  File "C:\pyton\venv\lib\site-packages\bs4\builder\", line 7, in <module>
    from bs4.element import (
  File "C:\pyton\venv\lib\site-packages\bs4\", line 19, in <module>
    from bs4.formatter import (
  File "C:\pyton\venv\lib\site-packages\bs4\", line 1, in <module>
    from bs4.dammit import EntitySubstitution
  File "C:\pyton\venv\lib\site-packages\bs4\", line 15, in <module>
    import logging
  File "C:\Python37\lib\logging\", line 28, in <module>
    from string import Template
  File "C:\pyton\", line 19
SyntaxError: EOF while scanning triple-quoted string literal

Leonard Richardson (leonardr) wrote :

It looks like you created a file called "" in your root Python directory. That's the file with the syntax error in it. "string" is the name of a standard library in Python. When the "logging" library tries to import that library, it's getting your "" instead.

Rename to something else and the problem should go away.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers