diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2012-04-16 08:58:23 -0400 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2012-04-16 08:58:23 -0400 |
commit | 55538ee74f6e0b28818e6a62d6160d910a55b2ec (patch) | |
tree | b13cca891224f354aac27f4b4c26d0150c637dcc /bs4/__init__.py | |
parent | 233cc621d768654ae86e74b753da02bd138cf2d1 (diff) |
Give a more useful error when the user tries to run the Python 2 version of BS under Python 3.
Diffstat (limited to 'bs4/__init__.py')
-rw-r--r-- | bs4/__init__.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bs4/__init__.py b/bs4/__init__.py index 68e9fed..b7f4898 100644 --- a/bs4/__init__.py +++ b/bs4/__init__.py @@ -42,6 +42,10 @@ from .element import ( Tag, ) +# The very first thing we do is give a useful error if someone is +# running this code under Python 3 without converting it. +syntax_error = u'You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work. You need to convert the code, either by installing it (`python setup.py install`) or by running 2to3 (`2to3 -w bs4`).' + class BeautifulSoup(Tag): """ This class defines the basic interface called by the tree builders. |